Class: Zitadel::Client::Auth::WebTokenAuthenticator::WebTokenAuthenticatorBuilder

Inherits:
OAuthAuthenticatorBuilder show all
Defined in:
lib/zitadel/client/auth/web_token_authenticator.rb

Overview

Builder for WebTokenAuthenticator.

Provides a fluent API for configuring and constructing a WebTokenAuthenticator instance.

Instance Method Summary collapse

Methods inherited from OAuthAuthenticatorBuilder

#scopes

Constructor Details

#initialize(host, jwt_issuer, jwt_subject, jwt_audience, private_key) ⇒ WebTokenAuthenticatorBuilder

Initializes the WebTokenAuthenticatorBuilder with required parameters.



133
134
135
136
137
138
139
140
141
# File 'lib/zitadel/client/auth/web_token_authenticator.rb', line 133

def initialize(host, jwt_issuer, jwt_subject, jwt_audience, private_key)
  # noinspection RubyArgCount
  super(host)
  @jwt_issuer = jwt_issuer
  @jwt_subject = jwt_subject
  @jwt_audience = jwt_audience
  @private_key = private_key
  @jwt_lifetime = 3600
end

Instance Method Details

#buildWebTokenAuthenticator

Constructs and returns a new WebTokenAuthenticator instance using the configured parameters.



160
161
162
163
# File 'lib/zitadel/client/auth/web_token_authenticator.rb', line 160

def build
  WebTokenAuthenticator.new(open_id, auth_scopes, @jwt_issuer, @jwt_subject, @jwt_audience,
                            @private_key, jwt_lifetime: @jwt_lifetime, key_id: @key_id)
end

#key_identifier(key_id) ⇒ Object



152
153
154
155
# File 'lib/zitadel/client/auth/web_token_authenticator.rb', line 152

def key_identifier(key_id)
  @key_id = key_id
  self
end

#token_lifetime_seconds(seconds) ⇒ WebTokenAuthenticatorBuilder

Sets the JWT token lifetime in seconds.



147
148
149
150
# File 'lib/zitadel/client/auth/web_token_authenticator.rb', line 147

def token_lifetime_seconds(seconds)
  @jwt_lifetime = seconds
  self
end