Method: Justa::TokenManager#setup_autenticators

Defined in:
lib/justa/token_manager.rb

#setup_autenticators(tokens) ⇒ Array

Sets authenticators based on tokens passed by constructor

Parameters:

  • tokens (Array)

    Array of tokens to be registered as clients

Returns:

  • (Array)

    Authenticators array



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/justa/token_manager.rb', line 48

def setup_autenticators(tokens)
  return @authenticators if @authenticators

  tokens = tokens.map { |t| Justa::Client.new(**t) }
  @mutex.synchronize do
    @authenticators = []
    tokens.each do |client|
      @authenticators << Authenticator.new(client)
    end
  end
end