We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1d883d5 commit 7e1b8c3Copy full SHA for 7e1b8c3
openc3/lib/openc3/utilities/authentication.rb
@@ -33,10 +33,15 @@ class OpenC3AuthenticationRetryableError < OpenC3AuthenticationError; end
33
# OpenC3 COSMOS Core authentication code
34
class OpenC3Authentication
35
def initialize()
36
- @token = ENV['OPENC3_API_PASSWORD']
37
- if @token.nil?
+ password = ENV['OPENC3_API_PASSWORD']
+ if password.nil?
38
raise OpenC3AuthenticationError, "Authentication requires environment variable OPENC3_API_PASSWORD"
39
end
40
+ if OpenC3::AuthModel.verify_password(password)
41
+ @token = OpenC3::AuthModel.generate_session()
42
+ else
43
+ raise OpenC3AuthenticationError, "Password is invalid"
44
+ end
45
46
47
# Load the token from the environment
0 commit comments