Class: Rubino::API::Operations::OAuth::Connections::DisconnectOperation
- Inherits:
-
Object
- Object
- Rubino::API::Operations::OAuth::Connections::DisconnectOperation
- Defined in:
- lib/rubino/api/operations/oauth/connections/disconnect_operation.rb
Overview
DELETE /v1/oauth/connections/:id Removes a stored OAuth connection (encrypted tokens included) and asks the provider to revoke the underlying token, so a DB dump + encryption-key compromise no longer yields indefinite provider-side access.
Provider revoke is best-effort: a failure (network, 4xx) is logged and the local row is still destroyed — leaving a stale local row is strictly worse than missing the revoke, since the user thinks the connection is gone and we’d keep using the encrypted tokens.
Instance Method Summary collapse
- #call(request) ⇒ Object
-
#initialize(repository: nil, registry: ::Rubino::OAuth::Registry, logger: nil) ⇒ DisconnectOperation
constructor
Accepts an alternate repository / registry / logger for tests.
Constructor Details
#initialize(repository: nil, registry: ::Rubino::OAuth::Registry, logger: nil) ⇒ DisconnectOperation
Accepts an alternate repository / registry / logger for tests.
23 24 25 26 27 |
# File 'lib/rubino/api/operations/oauth/connections/disconnect_operation.rb', line 23 def initialize(repository: nil, registry: ::Rubino::OAuth::Registry, logger: nil) @repository = repository @registry = registry @logger = logger end |
Instance Method Details
#call(request) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/rubino/api/operations/oauth/connections/disconnect_operation.rb', line 29 def call(request) id = request.params.fetch("id") connection = repository.find(id) raise NotFoundError.new("oauth_connection", id) unless connection revoke_remote(connection) repository.destroy!(id) [204, nil] end |