Class: OmniAuth::Strategies::Daccount

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/daccount.rb

Constant Summary collapse

BASE_SCOPES =

required scope.

"openid"
AUTH_IF =

0: Authenticate with contract account only, 1: Authenticate with all account.

1

Instance Method Summary collapse

Instance Method Details

#authorize_paramsObject



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/omniauth/strategies/daccount.rb', line 37

def authorize_params
  super.tap do |params|
    options[:authorize_options].each do |k|
      params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])
    end
    params[:scope] = BASE_SCOPES
    params[:authif] = AUTH_IF
    params[:nonce] = params[:state]
    session['omniauth.state'] = params[:state] if params[:state]
  end
end

#callback_phaseObject



53
54
55
# File 'lib/omniauth/strategies/daccount.rb', line 53

def callback_phase
  super
end

#callback_urlObject



77
78
79
# File 'lib/omniauth/strategies/daccount.rb', line 77

def callback_url
  full_host + script_name + callback_path
end

#raw_infoObject



72
73
74
75
# File 'lib/omniauth/strategies/daccount.rb', line 72

def raw_info
  access_token.options[:mode] = :header
  @raw_info ||= access_token.get('/common/userinfo').parsed
end

#request_phaseObject



29
30
31
32
33
34
35
# File 'lib/omniauth/strategies/daccount.rb', line 29

def request_phase
  options.client_options[:headers] = {
    "Content-Type" => "application/x-www-form-urlencoded",
    "Host" => full_host
  }
  super
end

#token_paramsObject



49
50
51
# File 'lib/omniauth/strategies/daccount.rb', line 49

def token_params
  super
end