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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e9e1bddbb16c68d1750bf462384f8db87c481b92c216fbe271efe66a9f68214
4
- data.tar.gz: c46233d0c20f38769aefba986181dca5d10e05c9b7b24e2dfd106ac4998259a4
3
+ metadata.gz: 8f87b3f785f970d1db82d00990a0ef09e1b6d12ae0b4db46207bf4a226abec8a
4
+ data.tar.gz: 33535e4793b65f6e4cc3ef97b9c5d32e4925301bc1b9ccb0c6c5a733dd1743b4
5
5
  SHA512:
6
- metadata.gz: 9b7bf89d83669346efa0f2aacdcd146c5447572954a511abb1691c310af26b4885b12f84e346c1ef010b373c16524edf4ca8e348f236c2b3d02589d3b75e0c0c
7
- data.tar.gz: f9bbe8eaf12fc8fd19dcaa183df744c893495a569cab609f45349c101d51d0ecc822719df9cda32123e20d06c5203c9475c7f061bd2ce248591af7da48dd8163
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::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/'
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Omniauth
4
4
  module Vipps
5
- VERSION = "1.0.2"
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.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maksim Hardziyenak