Class: AuthenticationService
- Inherits:
-
Object
- Object
- AuthenticationService
- Defined in:
- lib/services/authentication_service.rb
Overview
Authentication Service for token activies
Class Method Summary collapse
-
.create_authentication(auth_data) ⇒ Json
Creates authentication token.
-
.get_auth_with_client_info(auth_data) ⇒ Object
Sets Client id and secrets to Authentication object.
-
.refresh_authentication_token(auth_data, bearer_token) ⇒ Json
Refresh authentication token.
-
.revoke_authentication_token(auth_data, bearer_token) ⇒ Json
Revokes authentication token.
Class Method Details
.create_authentication(auth_data) ⇒ Json
Creates authentication token
17 18 19 20 21 22 23 24 |
# File 'lib/services/authentication_service.rb', line 17 def self.create_authentication(auth_data) auth_data = get_auth_with_client_info(auth_data) auth_payload = Authentication.get_payload(auth_data) RestClient::Request.execute(method: :post, url: ApplicationConfig.get_url('create_authentication_path'), payload: auth_payload, headers: { 'Content-Type': 'application/json' }) end |
.get_auth_with_client_info(auth_data) ⇒ Object
Sets Client id and secrets to Authentication object
68 69 70 71 72 |
# File 'lib/services/authentication_service.rb', line 68 def self.get_auth_with_client_info(auth_data) auth_data.client_id = ApplicationConfig.client_id auth_data.client_secret = ApplicationConfig.client_secret auth_data end |
.refresh_authentication_token(auth_data, bearer_token) ⇒ Json
Refresh authentication token
34 35 36 37 38 39 40 41 42 |
# File 'lib/services/authentication_service.rb', line 34 def self.refresh_authentication_token(auth_data, bearer_token) auth_data = get_auth_with_client_info(auth_data) auth_payload = Authentication.get_payload(auth_data) RestClient::Request.execute(method: :post, url: ApplicationConfig.get_url('create_authentication_path'), payload: auth_payload, headers: { 'Content-Type': 'application/json', 'Authorization': bearer_token }) end |
.revoke_authentication_token(auth_data, bearer_token) ⇒ Json
Revokes authentication token
52 53 54 55 56 57 58 59 |
# File 'lib/services/authentication_service.rb', line 52 def self.revoke_authentication_token(auth_data, bearer_token) auth_payload = Authentication.get_payload(auth_data) RestClient::Request.execute(method: :post, url: ApplicationConfig.get_url('revoke_authentication_path'), payload: auth_payload, headers: { 'Content-Type': 'application/json', 'Authorization': bearer_token }) end |