Method: Cosmos::CosmosKeycloakAuthentication#token
- Defined in:
- lib/cosmos/utilities/authentication.rb
#token ⇒ Object
Load the token from the environment
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/cosmos/utilities/authentication.rb', line 70 def token() @auth_mutex.synchronize do @log = [nil, nil] current_time = Time.now.to_i if @token.nil? _make_token(current_time) elsif @refresh_expires_at < current_time _make_token(current_time) elsif @expires_at < current_time _refresh_token(current_time) end end "Bearer #{@token}" end |