Class: OpenC3::OpenC3Authentication

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

Overview

OpenC3 base / open source authentication code

Direct Known Subclasses

OpenC3KeycloakAuthentication

Instance Method Summary collapse

Constructor Details

#initializeOpenC3Authentication

Returns a new instance of OpenC3Authentication.



34
35
36
37
38
39
# File 'lib/openc3/utilities/authentication.rb', line 34

def initialize()
  @token = ENV['OPENC3_API_PASSWORD']
  if @token.nil?
    raise OpenC3AuthenticationError, "Authentication requires environment variable OPENC3_API_PASSWORD"
  end
end

Instance Method Details

#tokenObject

Load the token from the environment



42
43
44
# File 'lib/openc3/utilities/authentication.rb', line 42

def token()
  @token
end