omniauth-vipps 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 427a035d7acd8eee313c79b2000650380e1983c4f7529ba0f4e79026f738139b
4
- data.tar.gz: 8edc21d20685a9e5a390280ba07914912a40d5da1f3f1131b4d665672e81800b
3
+ metadata.gz: 8f87b3f785f970d1db82d00990a0ef09e1b6d12ae0b4db46207bf4a226abec8a
4
+ data.tar.gz: 33535e4793b65f6e4cc3ef97b9c5d32e4925301bc1b9ccb0c6c5a733dd1743b4
5
5
  SHA512:
6
- metadata.gz: ac1f5fb7e3cab5193abc76ae0b79bd8a828429e19d97849e6906b73f659500fa17edffe34ed9c09b32b29b9fe0934aec7d2bb2e4d4a9476a0b9c007a062f8e26
7
- data.tar.gz: '080d6d7357c837eeab973690b5adb874f24296b65f682ede9dd3dfea764b4f240c7f61dcead4958cb805d0e19a3ab175a496862445f90bbae5099f6a1833b4d7'
6
+ metadata.gz: f48f26c4c4edb2c51fa104026754a60e2689de21bad10ffaedd8c0b8ea3785649f245e3bc686a8ace05cdc1ca6eacfb7fb38c6542da5c6cb5c8df66ef6da1971
7
+ data.tar.gz: a4f712877857f8e71393adbb5e3bc2d9695ddba89f7313928c0459c4fd5bb87e82e1a20e362479a55c87c8e5208a187f1a86e4fc31c1b514e702c1c761cf17c9
@@ -1,10 +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::Vipps
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/'
11
+
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
8
53
  end
9
54
  end
10
55
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Omniauth
4
4
  module Vipps
5
- VERSION = "1.0.1"
5
+ VERSION = "1.0.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-vipps
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maksim Hardziyenak