Class: Yadecli::Service::AuthenticationService
- Inherits:
-
Object
- Object
- Yadecli::Service::AuthenticationService
- Defined in:
- lib/yadecli/service/authentication_service.rb
Overview
connect
Instance Method Summary collapse
-
#initialize ⇒ AuthenticationService
constructor
A new instance of AuthenticationService.
- #login(auth_url, username, password) ⇒ Object
Constructor Details
#initialize ⇒ AuthenticationService
Returns a new instance of AuthenticationService.
10 11 12 |
# File 'lib/yadecli/service/authentication_service.rb', line 10 def initialize @authentication_client = Yadecli::Client::AuthenticationClient.new end |
Instance Method Details
#login(auth_url, username, password) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/yadecli/service/authentication_service.rb', line 14 def login(auth_url, username, password) CliUtil.print_header('Yade Login', ["Going to log in user #{username}, password: *** against uaa at #{auth_url}", '']) response = @authentication_client.request_token(auth_url, username, password) AppConfig[:auth_url] = auth_url AppConfig[:username] = username AppConfig[:password] = password AppConfig[:access_token] = response['access_token'] AppConfig[:refresh_token] = response['refresh_token'] AppConfig[:expiration_time] = Time.now + response['expires_in'] AppConfig.write! end |