Class: Legate::Auth::Coordinators::OAuth2Coordinator

Inherits:
Legate::Auth::Coordinator show all
Defined in:
lib/legate/auth/coordinators/oauth2_coordinator.rb

Overview

OAuth2Coordinator handles the interactive OAuth2 authentication flow using fibers. It manages pausing execution to request user authorization, and resuming once the authorization code is received.

Direct Known Subclasses

OIDCCoordinator

Defined Under Namespace

Modules: Steps

Constant Summary

Constants inherited from Legate::Auth::Coordinator

Legate::Auth::Coordinator::DEFAULT_TIMEOUT

Instance Attribute Summary

Attributes inherited from Legate::Auth::Coordinator

#error, #result, #status

Instance Method Summary collapse

Methods inherited from Legate::Auth::Coordinator

#cancel, #complete?, #resume, #start, #success?

Constructor Details

#initialize(scheme:, credential:, session_service:, token_store: nil, timeout: DEFAULT_TIMEOUT, redirect_uri: nil) ⇒ OAuth2Coordinator

Initialize a new OAuth2 coordinator

Parameters:

Raises:

  • (ArgumentError)


27
28
29
30
31
32
33
34
35
36
37
# File 'lib/legate/auth/coordinators/oauth2_coordinator.rb', line 27

def initialize(scheme:, credential:, session_service:, token_store: nil, timeout: DEFAULT_TIMEOUT, redirect_uri: nil)
  super(scheme: scheme, credential: credential, session_service: session_service, token_store: token_store, timeout: timeout)

  raise ArgumentError, "Expected an OAuth2 scheme, got #{scheme.class}" unless scheme.is_a?(Legate::Auth::Schemes::OAuth2)

  raise ArgumentError, "Credential must have auth_type :oauth2, got #{credential.auth_type}" unless credential.auth_type == :oauth2

  @redirect_uri = redirect_uri
  @current_step = Steps::AUTHORIZATION
  @auth_config = nil
end