230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
# File 'lib/openc3/microservices/reaction_microservice.rb', line 230
def get_token(username)
if ENV['OPENC3_API_CLIENT'].nil?
ENV['OPENC3_API_PASSWORD'] ||= ENV['OPENC3_SERVICE_PASSWORD']
return OpenC3Authentication.new().token
else
model = nil
model = OpenC3::OfflineAccessModel.get_model(name: username, scope: @scope) if username and username != ''
if model and model.offline_access_token
auth = OpenC3KeycloakAuthentication.new(ENV['OPENC3_KEYCLOAK_URL'])
return auth.get_token_from_refresh_token(model.offline_access_token)
else
return nil
end
end
end
|