This repository has been archived by the owner on Aug 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [SDK-273]: Update strategy and bump version * [SDK-273]: Update strategy and bump version * [SDK-273]: Add minor tweaks
- Loading branch information
Showing
8 changed files
with
136 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,13 @@ gem 'omniauth-yoti' | |
And then execute: | ||
|
||
```shell | ||
$ bundle | ||
bundle | ||
``` | ||
|
||
Or install it yourself as: | ||
|
||
```shell | ||
$ gem install omniauth-yoti | ||
gem install omniauth-yoti | ||
``` | ||
|
||
## Configuration | ||
|
@@ -63,21 +63,42 @@ A call to `/auth/yoti/callback` will open the Yoti authentication page, and afte | |
"provider" => "yoti", | ||
"uid" => "mHvpV4...", | ||
"info" => { | ||
"name" => "mHvpV4Mm+yMb...", | ||
"base64_selfie_uri" => "data:image/jpeg;base64,/9j/2wCEAAMCAg..." | ||
}, | ||
"name" => "John Doe", | ||
"selfie" => "jpeg image data file", | ||
"full_name" => "John Doe", | ||
"given_names" => "John", | ||
"family_name" => "Doe", | ||
"phone_number" => "07474747474", | ||
"email_address" => "[email protected]", | ||
"date_of_birth" => "1989-11-09", | ||
"postal_address" => "Fountain House\n130 Fenchurch St\nLONDON\nEC3M 5DJ", | ||
"gender" => "MALE", | ||
"nationality" => "GBR" | ||
"base64_selfie_uri" => "data:image/jpeg;base64,/9j/2wCEAAMCAg..." | ||
"age_verified" => true | ||
}, | ||
"credentials" => {}, | ||
"extra" => { | ||
"selfie" => "jpeg image file", | ||
"given_names" => "Given Name", | ||
"family_name" => "Family Name", | ||
"phone_number" => "07474747474", | ||
"email_address" => "[email protected]", | ||
"date_of_birth" => nil, | ||
"postal_address" => nil, | ||
"gender" => 'MALE', | ||
"nationality" => nil | ||
} | ||
{ "raw_info" => | ||
{ | ||
"selfie" => "jpeg image data file", | ||
"full_name" => "John Doe", | ||
"given_names" => "Given Name", | ||
"family_name" => "Family Name", | ||
"phone_number" => "07474747474", | ||
"email_address" => "[email protected]", | ||
"date_of_birth" => "1989-11-09", | ||
"postal_address" => "Fountain House\n130 Fenchurch St\nLONDON\nEC3M 5DJ", | ||
"gender" => "MALE", | ||
"nationality" => "GBR", | ||
"age_over:18" => true | ||
} | ||
} | ||
} | ||
|
||
``` | ||
|
||
## Upgrading from version 1.1 | ||
|
||
Most of the profile attributes that were being stored in the `extra` fields got moved to `info`. | ||
|
||
e.g. `request.env['omniauth.auth']['extra']['given_names']` will become `request.env['omniauth.auth']['info']['given_names']` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module Omniauth | ||
module Yoti | ||
VERSION = '1.1.3'.freeze | ||
VERSION = '1.2.0'.freeze | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,78 +46,78 @@ | |
end | ||
|
||
describe '#info' do | ||
it 'returns the name value' do | ||
expect(subject.info[:name]).to eql('Hig2yAT79cWvseSuXcIuCLa5lNkAPy70rxetUaeHlTJGmiwc/g1MWdYWYrexWvPU') | ||
context 'when using a mock request' do | ||
it 'returns the base64_selfie_uri value' do | ||
selfie = File.read('spec/fixtures/selfie.txt', encoding: 'utf-8') | ||
expect(subject.info[:base64_selfie_uri]).to eql(selfie) | ||
end | ||
end | ||
|
||
it 'returns the base64_selfie_uri value' do | ||
selfie = File.read('spec/fixtures/selfie.txt', encoding: 'utf-8') | ||
expect(subject.info[:base64_selfie_uri]).to eql(selfie) | ||
context 'when using a mock object' do | ||
before do | ||
allow(subject).to receive(:yoti_user_profile).and_return(yoti_user_profile_mock) | ||
allow(subject).to receive(:base64_selfie_uri).and_return(base64_selfie_uri_mock) | ||
allow(subject).to receive(:age_verified).and_return(age_verified_mock) | ||
end | ||
|
||
it 'returns the correct values' do | ||
expect(subject.info[:name]).to eql('John Doe') | ||
expect(subject.info[:selfie]).to eql('selfie.png') | ||
expect(subject.info[:full_name]).to eql('John Doe') | ||
expect(subject.info[:given_names]).to eql('John') | ||
expect(subject.info[:family_name]).to eql('Doe') | ||
expect(subject.info[:phone_number]).to eql('07474747474') | ||
expect(subject.info[:email_address]).to eql('[email protected]') | ||
expect(subject.info[:date_of_birth]).to eql('2000.12.12') | ||
expect(subject.info[:postal_address]).to eql('WC2N 4JH') | ||
expect(subject.info[:gender]).to eql('male') | ||
expect(subject.info[:nationality]).to eql('British') | ||
expect(subject.info[:base64_selfie_uri]).to eql('data:image/jpeg;base64,/9j/2wCEAAMCAg') | ||
expect(subject.info[:age_verified]).to eql(true) | ||
end | ||
end | ||
end | ||
|
||
describe '#extra' do | ||
context 'when using a mock request' do | ||
it 'has the correct selfie' do | ||
selfie = File.read('spec/fixtures/selfie.txt', encoding: 'utf-8') | ||
expect('data:image/jpeg;base64,'.concat(Base64.strict_encode64(subject.extra[:selfie]))).to eql(selfie) | ||
expect('data:image/jpeg;base64,'.concat(Base64.strict_encode64(subject.extra[:raw_info]['selfie']))).to eql(selfie) | ||
end | ||
|
||
it 'has the correct phone number' do | ||
expect(subject.extra[:phone_number]).to eql('+447474747474') | ||
expect(subject.extra[:raw_info]['phone_number']).to eql('+447474747474') | ||
end | ||
end | ||
|
||
context 'when using a mock object' do | ||
before do | ||
allow(subject).to receive(:yoti_user_profile).and_return(raw_info_hash) | ||
end | ||
|
||
it 'has the correct selfie' do | ||
expect(subject.extra[:selfie]).to eql('selfie.png') | ||
end | ||
|
||
it 'has the correct given names' do | ||
expect(subject.extra[:given_names]).to eql('Given Names') | ||
end | ||
|
||
it 'has the correct family name' do | ||
expect(subject.extra[:family_name]).to eql('Family Name') | ||
allow(subject).to receive(:yoti_user_profile).and_return(yoti_user_profile_mock) | ||
end | ||
|
||
it 'has the correct mobile number' do | ||
expect(subject.extra[:phone_number]).to eql('07474747474') | ||
end | ||
|
||
it 'has the correct email address' do | ||
expect(subject.extra[:email_address]).to eql('[email protected]') | ||
end | ||
|
||
it 'has the correct date of birth' do | ||
expect(subject.extra[:date_of_birth]).to eql('2000.12.12') | ||
end | ||
|
||
it 'has the correct postal address' do | ||
expect(subject.extra[:postal_address]).to eql('WC2N 4JH') | ||
end | ||
|
||
it 'has the correct gender' do | ||
expect(subject.extra[:gender]).to eql('male') | ||
end | ||
|
||
it 'has the correct nationality' do | ||
expect(subject.extra[:nationality]).to eql('British') | ||
it 'returns the correct values' do | ||
expect(subject.extra[:raw_info]['selfie']).to eql('selfie.png') | ||
expect(subject.extra[:raw_info]['full_name']).to eql('John Doe') | ||
expect(subject.extra[:raw_info]['given_names']).to eql('John') | ||
expect(subject.extra[:raw_info]['family_name']).to eql('Doe') | ||
expect(subject.extra[:raw_info]['phone_number']).to eql('07474747474') | ||
expect(subject.extra[:raw_info]['email_address']).to eql('[email protected]') | ||
expect(subject.extra[:raw_info]['date_of_birth']).to eql('2000.12.12') | ||
expect(subject.extra[:raw_info]['postal_address']).to eql('WC2N 4JH') | ||
expect(subject.extra[:raw_info]['gender']).to eql('male') | ||
expect(subject.extra[:raw_info]['nationality']).to eql('British') | ||
end | ||
end | ||
end | ||
|
||
private | ||
|
||
def raw_info_hash | ||
def yoti_user_profile_mock | ||
{ | ||
'selfie' => 'selfie.png', | ||
'given_names' => 'Given Names', | ||
'family_name' => 'Family Name', | ||
'full_name' => 'John Doe', | ||
'given_names' => 'John', | ||
'family_name' => 'Doe', | ||
'phone_number' => '07474747474', | ||
'email_address' => '[email protected]', | ||
'date_of_birth' => '2000.12.12', | ||
|
@@ -126,4 +126,12 @@ def raw_info_hash | |
'nationality' => 'British' | ||
} | ||
end | ||
|
||
def base64_selfie_uri_mock | ||
'data:image/jpeg;base64,/9j/2wCEAAMCAg' | ||
end | ||
|
||
def age_verified_mock | ||
true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters