Class: Zitadel::Client::Auth::OAuthAuthenticatorBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/zitadel/client/auth/authenticator.rb,
sig/lib.rbs

Overview

Abstract builder class for constructing OAuth authenticator instances.

This builder provides common configuration options such as the OpenId instance and authentication scopes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, transport_options: nil) ⇒ OAuthAuthenticatorBuilder

Initializes the OAuthAuthenticatorBuilder with a given host.

Parameters:

  • host (String)

    the base URL for the OAuth provider.

  • transport_options (TransportOptions, nil) (defaults to: nil)

    Optional transport options for TLS, proxy, and headers.

  • (String)
  • transport_options: (TransportOptions, nil) (defaults to: nil)


61
62
63
64
65
66
# File 'lib/zitadel/client/auth/authenticator.rb', line 61

def initialize(host, transport_options: nil)
  transport_options ||= TransportOptions.defaults
  @transport_options = transport_options
  @open_id = OpenId.new(host, transport_options: transport_options)
  @auth_scopes = Set.new(%w[openid urn:zitadel:iam:org:project:id:zitadel:aud])
end

Instance Attribute Details

#auth_scopesSet[String] (readonly)

Returns the value of attribute auth_scopes.

Returns:

  • (Set[String])


53
54
55
# File 'lib/zitadel/client/auth/authenticator.rb', line 53

def auth_scopes
  @auth_scopes
end

#open_idOpenId (readonly)

Returns the value of attribute open_id.

Returns:



53
54
55
# File 'lib/zitadel/client/auth/authenticator.rb', line 53

def open_id
  @open_id
end

Instance Method Details

#scopes(*scopes) ⇒ self

Sets the authentication scopes for the OAuth authenticator.

Parameters:

  • scopes (Array<String>)

    a variable number of scope strings.

  • (String)

Returns:

  • (self)

    the builder instance to allow for method chaining.



76
77
78
79
# File 'lib/zitadel/client/auth/authenticator.rb', line 76

def scopes(*scopes)
  @auth_scopes = Set.new(scopes)
  self
end