Class: Zitadel::Client::Auth::PersonalAccessTokenAuthenticator

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

Overview

Personal Access Token Authenticator.

Uses a static personal access token for API authentication.

Instance Attribute Summary

Attributes inherited from Authenticator

#host

Instance Method Summary collapse

Constructor Details

#initialize(host, token) ⇒ PersonalAccessTokenAuthenticator

Initializes the PersonalAccessTokenAuthenticator with host and token.

Parameters:

  • host (String)

    the base URL for the service.

  • token (String)

    the personal access token.

  • (String)
  • (String)


18
19
20
21
22
# File 'lib/zitadel/client/auth/personal_access_token_authenticator.rb', line 18

def initialize(host, token)
  # noinspection RubyArgCount
  super(Utils::UrlUtil.build_hostname(host))
  @token = token
end

Instance Method Details

#auth_headersHash{String => String}

Returns the authentication headers using the personal access token.

Returns:

  • (Hash{String => String})

    a hash containing the 'Authorization' header.



31
32
33
# File 'lib/zitadel/client/auth/personal_access_token_authenticator.rb', line 31

def auth_headers
  { 'Authorization' => "Bearer #{@token}" }
end