Class: Rubino::API::Operations::OAuth::Providers::ConnectOperation
- Inherits:
-
Object
- Object
- Rubino::API::Operations::OAuth::Providers::ConnectOperation
- Defined in:
- lib/rubino/api/operations/oauth/providers/connect_operation.rb
Overview
POST /v1/oauth/providers/:id/connect
Builds a PKCE authorize request for the provider and returns { authorize_url, state, code_verifier, provider }. The client persists state + code_verifier between connect and callback; rubino stays stateless on the OAuth flow itself.
Class Method Summary collapse
Instance Method Summary collapse
- #call(request) ⇒ Object
-
#initialize(registry: ::Rubino::OAuth::Registry) ⇒ ConnectOperation
constructor
Accepts an alternate provider registry for tests.
Constructor Details
#initialize(registry: ::Rubino::OAuth::Registry) ⇒ ConnectOperation
Accepts an alternate provider registry for tests.
23 24 25 |
# File 'lib/rubino/api/operations/oauth/providers/connect_operation.rb', line 23 def initialize(registry: ::Rubino::OAuth::Registry) @registry = registry end |
Class Method Details
.call(request) ⇒ Object
18 19 20 |
# File 'lib/rubino/api/operations/oauth/providers/connect_operation.rb', line 18 def self.call(request) new.call(request) end |
Instance Method Details
#call(request) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rubino/api/operations/oauth/providers/connect_operation.rb', line 27 def call(request) id = request.params.fetch("id") provider = @registry.fetch(id) attrs = request.validate!(Schemas::ConnectProvider) flow = provider.( redirect_uri: attrs[:redirect_uri], scopes: attrs[:scopes] ) [200, flow.merge(provider: provider.id)] end |