Module: SignIn::Authentication

Extended by:
ActiveSupport::Concern
Included in:
AuthenticationAndSSOConcerns, Instrumentation, ApplicationController
Defined in:
app/controllers/concerns/sign_in/authentication.rb

Constant Summary collapse

BEARER_PATTERN =
/^Bearer /

Instance Method Summary collapse

Instance Method Details

#authenticateObject (protected)



17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/concerns/sign_in/authentication.rb', line 17

def authenticate
  @access_token = authenticate_access_token
  @current_user = load_user_object
  validate_request_ip
  @current_user.present?
rescue Errors::AccessTokenExpiredError => e
  render json: { errors: e }, status: :forbidden
rescue Errors::StandardError => e
  handle_authenticate_error(e)
end

#authenticate_service_accountObject (protected)



39
40
41
42
43
44
45
46
47
# File 'app/controllers/concerns/sign_in/authentication.rb', line 39

def 
  @service_account_access_token = 
  validate_requested_scope
  @service_account_access_token.present?
rescue Errors::AccessTokenExpiredError => e
  render json: { errors: e }, status: :forbidden
rescue Errors::StandardError => e
  handle_authenticate_error(e)
end

#load_user(skip_expiration_check: false) ⇒ Object (protected)



28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/concerns/sign_in/authentication.rb', line 28

def load_user(skip_expiration_check: false)
  @access_token = authenticate_access_token
  @current_user = load_user_object
  validate_request_ip
  @current_user.present?
rescue Errors::AccessTokenExpiredError => e
  render json: { errors: e }, status: :forbidden unless skip_expiration_check
rescue Errors::StandardError
  nil
end