Class: Cosmos::CosmosAuthentication

Inherits:
Object
  • Object
show all
Defined in:
lib/cosmos/utilities/authentication.rb

Overview

Cosmos base / open source authentication code

Direct Known Subclasses

CosmosKeycloakAuthentication

Instance Method Summary collapse

Constructor Details

#initializeCosmosAuthentication

Returns a new instance of CosmosAuthentication.



31
32
33
34
35
36
# File 'lib/cosmos/utilities/authentication.rb', line 31

def initialize()
  @token = ENV['COSMOS_API_PASSWORD'] || ENV['COSMOS_SERVICE_PASSWORD']
  if @token.nil?
    raise CosmosAuthenticationError, "Authentication requires environment variables COSMOS_API_PASSWORD or COSMOS_SERVICE_PASSWORD"
  end
end

Instance Method Details

#tokenObject

Load the token from the environment



39
40
41
# File 'lib/cosmos/utilities/authentication.rb', line 39

def token()
  @token
end