omniauth-vipps 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/omniauth/strategies/vipps_test.rb +44 -1
- data/lib/omniauth-vipps/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f87b3f785f970d1db82d00990a0ef09e1b6d12ae0b4db46207bf4a226abec8a
|
4
|
+
data.tar.gz: 33535e4793b65f6e4cc3ef97b9c5d32e4925301bc1b9ccb0c6c5a733dd1743b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f48f26c4c4edb2c51fa104026754a60e2689de21bad10ffaedd8c0b8ea3785649f245e3bc686a8ace05cdc1ca6eacfb7fb38c6542da5c6cb5c8df66ef6da1971
|
7
|
+
data.tar.gz: a4f712877857f8e71393adbb5e3bc2d9695ddba89f7313928c0459c4fd5bb87e82e1a20e362479a55c87c8e5208a187f1a86e4fc31c1b514e702c1c761cf17c9
|
@@ -1,12 +1,55 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require 'omniauth-oauth2'
|
2
3
|
|
3
4
|
module OmniAuth
|
4
5
|
module Strategies
|
5
6
|
# Main class for Vipps OAuth2 strategy.
|
6
|
-
class VippsTest < OmniAuth::Strategies::
|
7
|
+
class VippsTest < OmniAuth::Strategies::OAuth2
|
8
|
+
DEFAULT_SCOPE = 'openid name phoneNumber address birthDate email'
|
7
9
|
BASE_URL = 'https://apitest.vipps.no'
|
10
|
+
USER_INFO_URL = '/vipps-userinfo-api/userinfo/'
|
8
11
|
|
9
12
|
option :name, 'vipps_test'
|
13
|
+
option :market, 'NO'
|
14
|
+
option :scope, DEFAULT_SCOPE
|
15
|
+
|
16
|
+
option :client_options,
|
17
|
+
auth_scheme: :request_body,
|
18
|
+
site: BASE_URL,
|
19
|
+
authorize_url: "#{BASE_URL}/access-management-1.0/access/oauth2/auth",
|
20
|
+
token_url: "#{BASE_URL}/access-management-1.0/access/oauth2/token"
|
21
|
+
|
22
|
+
option :token_params, {
|
23
|
+
grant_type: 'authorization_code'
|
24
|
+
}
|
25
|
+
|
26
|
+
uid { raw_info['sub'] }
|
27
|
+
|
28
|
+
info do
|
29
|
+
{
|
30
|
+
address: raw_info['address'],
|
31
|
+
birth_date: raw_info['birthdate'],
|
32
|
+
email: raw_info['email'],
|
33
|
+
email_verified: raw_info['email_verified'],
|
34
|
+
family_name: raw_info['family_name'],
|
35
|
+
given_name: raw_info['given_name'],
|
36
|
+
name: raw_info['name'],
|
37
|
+
other_addresses: raw_info['other_addresses'],
|
38
|
+
phone_number: raw_info['phone_number'],
|
39
|
+
sid: raw_info['sid'],
|
40
|
+
sub: raw_info['sub'],
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
def raw_info
|
45
|
+
@raw_info ||= access_token.get(USER_INFO_URL).parsed
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def callback_url
|
51
|
+
options[:redirect_uri] || (full_host + callback_path)
|
52
|
+
end
|
10
53
|
end
|
11
54
|
end
|
12
55
|
end
|