Class: OmniAuth::Strategies::AituPassport

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

Overview

AituPassport omniauth provider

Constant Summary collapse

AVAILABLE_SCOPE_OPTIONS =
%w[
  openid
  phone
  first_name
  middle_name
  last_name
  birth_date
  gender
  id_card_manual
  residence_address_manual
  registration_address_manual
  identification_video_recording
  sign
  liveness
  liveness_3d
  residence_permit_manual
  identification_document_manual
  identification_document_ocr
  identification_document_mrz
  idpc_verification
  wallet_read
  wallet
].freeze
DEFAULT_SCOPE =
'openid phone'
ALLOWED_ISS =
%w[https://passport.test.supreme-team.tech https://passport.aitu.io].freeze

Instance Method Summary collapse

Constructor Details

#initialize(app, *args, &block) ⇒ AituPassport

Omniauth::Strategy



94
95
96
97
98
99
100
101
102
# File 'lib/omniauth/strategies/aitu_passport.rb', line 94

def initialize(app, *args, &block)
  # Setting up corresponding options
  super.tap do
    # Raising up an error if redirect_uri is missing
    raise ArgumentError, 'Wrong options: redirect_uri option is missing.' unless options[:redirect_uri]

    options[:client_options][:site] = 'https://passport.test.supreme-team.tech' if ENV['PASSPORT_STAGING']
  end
end

Instance Method Details

#authorize_paramsObject

Omniauth::Strategies::Oauth2



105
106
107
108
109
110
111
# File 'lib/omniauth/strategies/aitu_passport.rb', line 105

def authorize_params
  super.tap do |params|
    params[:scope] = filter_scope(params)
    params[:redirect_uri] = options[:redirect_uri]
    params[:session_id] = get_session_id
  end
end

#raw_infoObject



113
114
115
# File 'lib/omniauth/strategies/aitu_passport.rb', line 113

def raw_info
  @raw_info ||= access_token.get('/userinfo').parsed
end