Class: Basecamp::Oauth::Config

Inherits:
Data
  • Object
show all
Defined in:
lib/basecamp/oauth/config.rb

Overview

OAuth 2 server configuration from an Authorization Server Metadata document (RFC 8414).

As of BC5 resource-first discovery, authorization_endpoint is OPTIONAL: device-only authorization servers omit it, so authorization-code consumers MUST assert its presence before use. token_endpoint stays required.

NOTE: device_authorization_endpoint is APPENDED after the pre-existing members. Data.define's member order is the positional/deconstruct order, so inserting a new field mid-list would shift positional callers (and pattern matches). Keep new fields last for positional compatibility.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(issuer:, token_endpoint:, authorization_endpoint: nil, registration_endpoint: nil, scopes_supported: nil, grant_types_supported: nil, device_authorization_endpoint: nil) ⇒ Config

Returns a new instance of Config.



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/basecamp/oauth/config.rb', line 32

def initialize(
  issuer:,
  token_endpoint:,
  authorization_endpoint: nil,
  registration_endpoint: nil,
  scopes_supported: nil,
  grant_types_supported: nil,
  device_authorization_endpoint: nil
)
  super
end

Instance Attribute Details

#authorization_endpointString? (readonly)

URL of the authorization endpoint (optional)

Returns:

  • (String, nil)

    the current value of authorization_endpoint



23
24
25
# File 'lib/basecamp/oauth/config.rb', line 23

def authorization_endpoint
  @authorization_endpoint
end

#device_authorization_endpointString? (readonly)

URL of the RFC 8628 device authorization endpoint

Returns:

  • (String, nil)

    the current value of device_authorization_endpoint



23
24
25
# File 'lib/basecamp/oauth/config.rb', line 23

def device_authorization_endpoint
  @device_authorization_endpoint
end

#grant_types_supportedArray<String>? (readonly)

OAuth 2 grant types the server supports

Returns:

  • (Array<String>, nil)

    the current value of grant_types_supported



23
24
25
# File 'lib/basecamp/oauth/config.rb', line 23

def grant_types_supported
  @grant_types_supported
end

#issuerString (readonly)

The authorization server's issuer identifier

Returns:

  • (String)

    the current value of issuer



23
24
25
# File 'lib/basecamp/oauth/config.rb', line 23

def issuer
  @issuer
end

#registration_endpointString? (readonly)

URL of the dynamic client registration endpoint

Returns:

  • (String, nil)

    the current value of registration_endpoint



23
24
25
# File 'lib/basecamp/oauth/config.rb', line 23

def registration_endpoint
  @registration_endpoint
end

#scopes_supportedArray<String>? (readonly)

List of OAuth 2 scopes supported

Returns:

  • (Array<String>, nil)

    the current value of scopes_supported



23
24
25
# File 'lib/basecamp/oauth/config.rb', line 23

def scopes_supported
  @scopes_supported
end

#token_endpointString (readonly)

URL of the token endpoint

Returns:

  • (String)

    the current value of token_endpoint



23
24
25
# File 'lib/basecamp/oauth/config.rb', line 23

def token_endpoint
  @token_endpoint
end