Class: StandardId::Api::SessionsController
- Inherits:
-
BaseController
- Object
- ActionController::API
- BaseController
- StandardId::Api::SessionsController
- Defined in:
- app/controllers/standard_id/api/sessions_controller.rb
Constant Summary
Constants included from RateLimitHandling
RateLimitHandling::RATE_LIMIT_STORE
Instance Method Summary collapse
Methods included from ControllerPolicy
all_controllers, authenticated_controllers, public_controllers, register, registry_snapshot, reset_registry!
Instance Method Details
#destroy ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/standard_id/api/sessions_controller.rb', line 15 def destroy session = current_account.sessions.find_by(id: params[:id]) unless session render json: { error: "not_found", error_description: "Session not found" }, status: :not_found return end session.revoke!(reason: "api_revocation") head :no_content end |
#index ⇒ Object
9 10 11 12 13 |
# File 'app/controllers/standard_id/api/sessions_controller.rb', line 9 def index sessions = current_account.sessions.active.order(created_at: :desc) render json: sessions.map { |session| serialize_session(session) } end |