Method: Justa::TokenManager.token_for
- Defined in:
- lib/justa/token_manager.rb
.token_for(key = Justa.default_client_key) ⇒ String
Find a token for a specific Client Key
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/justa/token_manager.rb', line 67 def self.token_for(key = Justa.default_client_key) instance unless @instance k = Justa::Util.to_sym(key) raise MissingCredentialsError, "Missing credentials for key: '#{key}'" unless @instance.authenticators @instance.mutex.synchronize do auth = @instance.authenticators.find { |obj| obj.key == k } raise MissingCredentialsError, "Missing credentials for key: '#{key}'" if auth.blank? auth.token end end |