Class: KeycloakOauth::AuthenticationServiceBase

Inherits:
Object
  • Object
show all
Defined in:
app/services/keycloak_oauth/authentication_service_base.rb

Constant Summary collapse

ACCESS_TOKEN_KEY =
'access_token'.freeze
ACCESS_TOKEN_EXPIRES_IN =
'expires_in'.freeze
REFRESH_TOKEN_KEY =
'refresh_token'.freeze
REFRESH_TOKEN_EXPIRES_IN =
'refresh_expires_in'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session:) ⇒ AuthenticationServiceBase

Returns a new instance of AuthenticationServiceBase.



10
11
12
# File 'app/services/keycloak_oauth/authentication_service_base.rb', line 10

def initialize(session:)
  @session = session
end

Instance Attribute Details

#sessionObject (readonly)

Returns the value of attribute session.



8
9
10
# File 'app/services/keycloak_oauth/authentication_service_base.rb', line 8

def session
  @session
end

Instance Method Details

#authenticateObject



14
15
16
17
18
19
# File 'app/services/keycloak_oauth/authentication_service_base.rb', line 14

def authenticate
  request_time = Time.zone.now
  post_token_service = post_service_name.new(**post_service_arguments)
  post_token_service.perform
  store_credentials_in_session(post_token_service, request_time)
end