Class: OmniAuth::Strategies::AzureActiveDirectoryB2C

Inherits:
Object
  • Object
show all
Includes:
AzureActiveDirectory, OmniAuth::Strategy
Defined in:
lib/omniauth/strategies/azure_activedirectoryb2c.rb

Overview

A strategy for authentication against Azure Active Directory.

Defined Under Namespace

Classes: OAuthError

Constant Summary collapse

DEFAULT_RESPONSE_TYPE =

uid

(JWT.decode(request.params['id_token'], nil, false).first)['sub']

info do

{
    #name: raw_info['name'],
    #nickname: raw_info['unique_name'],
    #first_name: raw_info['given_name'],
    #last_name: raw_info['family_name'],
    #email: raw_info['email'] || raw_info['upn'],
    #oid: raw_info['oid'],
    #tid: raw_info['tid']
}

end

'code id_token'
DEFAULT_RESPONSE_MODE =
'form_post'

Instance Method Summary collapse

Instance Method Details

#callback_phaseObject

Overridden method from OmniAuth::Strategy. This is the second step in the authentication process. It is called after the user enters credentials at the authorization endpoint.



97
98
99
100
101
102
103
104
105
106
# File 'lib/omniauth/strategies/azure_activedirectoryb2c.rb', line 97

def callback_phase
  #raise request.params.inspect
  error = request.params['error_reason'] || request.params['error']
  fail(OAuthError, error) if error
  @id_token = request.params['id_token']
  @code = request.params['code']
  @claims, @header = validate_and_parse_id_token(@id_token)
  validate_chash(@code, @claims, @header)
  super
end

#request_phaseObject

Overridden method from OmniAuth::Strategy. This is the first step in the authentication process.



89
90
91
# File 'lib/omniauth/strategies/azure_activedirectoryb2c.rb', line 89

def request_phase
  redirect authorize_endpoint_url
end