omniauth-latvija 4.0.0 → 5.0.0
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 +5 -5
- data/README.md +8 -7
- data/lib/omniauth-latvija/version.rb +1 -1
- data/lib/omniauth/strategies/latvija.rb +26 -4
- data/lib/omniauth/strategies/latvija/response.rb +19 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9bd3dccbc8a7d0c3085a09fdbdfcade5add5a37957b3feb2bfc39db7a645ff6e
|
4
|
+
data.tar.gz: 6ecb7bd1e3a242e1e7fce010e4902c7937953da93abda12b2567c7fd61e1f2e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ce3aac6b6409192882ea39b190dd77b5e364bc038c7204d6bdaeb76b546529eaf9b60c07cb445b36b57216379b9977257775a94bda4b64eaa5f1e3a2392d9df
|
7
|
+
data.tar.gz: 9a951c691b8314fd084a490cbe528e66901bf77da147f6412eeedd7208b334df9998e966c32accf02002c880524cd3e9b9300b97fb1c0c90907e2e79e0051f43
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ Provides the following authentication types:
|
|
19
19
|
## Installation
|
20
20
|
|
21
21
|
```ruby
|
22
|
-
gem 'omniauth-latvija'
|
22
|
+
gem 'omniauth-latvija'
|
23
23
|
```
|
24
24
|
|
25
25
|
## Usage
|
@@ -47,7 +47,7 @@ Here's an example hash available in `request.env['omniauth.auth']`
|
|
47
47
|
```ruby
|
48
48
|
{
|
49
49
|
provider: 'latvija',
|
50
|
-
uid: '
|
50
|
+
uid: 'PK:12345612345',
|
51
51
|
info: {
|
52
52
|
name: 'JANIS BERZINS',
|
53
53
|
first_name: 'JANIS',
|
@@ -56,14 +56,15 @@ Here's an example hash available in `request.env['omniauth.auth']`
|
|
56
56
|
},
|
57
57
|
extra: {
|
58
58
|
raw_info: {
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
givenname: 'JANIS',
|
60
|
+
surname: 'BERZINS',
|
61
|
+
privatepersonalidentifier: '12345612345',
|
62
|
+
historical_privatepersonalidentifier: [],
|
63
63
|
not_valid_before: '2019-05-09T07:29:41Z',
|
64
64
|
not_valid_on_or_after: '2019-05-09T08:29:41Z'
|
65
65
|
},
|
66
|
-
authentication_method: 'SWEDBANK'
|
66
|
+
authentication_method: 'SWEDBANK',
|
67
|
+
legacy_uids: ['JANIS BERZINS, 12345612345']
|
67
68
|
}
|
68
69
|
}
|
69
70
|
```
|
@@ -34,11 +34,9 @@ module OmniAuth::Strategies
|
|
34
34
|
option :certificate, nil
|
35
35
|
option :private_key, nil
|
36
36
|
|
37
|
-
uid { "#{raw_info['givenname']} #{raw_info['surname']}, #{raw_info["privatepersonalidentifier"]}" }
|
38
|
-
|
39
37
|
info do
|
40
38
|
{
|
41
|
-
name:
|
39
|
+
name: full_name,
|
42
40
|
first_name: raw_info['givenname'],
|
43
41
|
last_name: raw_info['surname'],
|
44
42
|
private_personal_identifier: raw_info['privatepersonalidentifier']
|
@@ -48,7 +46,8 @@ module OmniAuth::Strategies
|
|
48
46
|
extra do
|
49
47
|
{
|
50
48
|
raw_info: raw_info,
|
51
|
-
authentication_method: @response.authentication_method
|
49
|
+
authentication_method: @response.authentication_method,
|
50
|
+
legacy_uids: legacy_uids
|
52
51
|
}
|
53
52
|
end
|
54
53
|
|
@@ -85,5 +84,28 @@ module OmniAuth::Strategies
|
|
85
84
|
def raw_info
|
86
85
|
@response.attributes
|
87
86
|
end
|
87
|
+
|
88
|
+
def uid
|
89
|
+
@response.name_identifier
|
90
|
+
end
|
91
|
+
|
92
|
+
def full_name
|
93
|
+
@full_name ||= "#{raw_info['givenname']} #{raw_info['surname']}"
|
94
|
+
end
|
95
|
+
|
96
|
+
def legacy_uids
|
97
|
+
# UIDs that could have been assigned to this identity by previous versions of the gem, or due to peronal identifier change
|
98
|
+
|
99
|
+
legacy_uids = [
|
100
|
+
"#{full_name}, #{raw_info["privatepersonalidentifier"]}" # generated by gem version <= 4.0
|
101
|
+
]
|
102
|
+
|
103
|
+
raw_info.fetch('historical_privatepersonalidentifier', []).each do |historical_identifier|
|
104
|
+
legacy_uids << "#{full_name}, #{historical_identifier}" # generated by gem version <= 4.0
|
105
|
+
legacy_uids << "PK:#{historical_identifier}" # due to personal identifier change
|
106
|
+
end
|
107
|
+
|
108
|
+
legacy_uids
|
109
|
+
end
|
88
110
|
end
|
89
111
|
end
|
@@ -26,23 +26,39 @@ module OmniAuth::Strategies
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
def name_identifier
|
30
|
+
@name_identifier ||= begin
|
31
|
+
xml.xpath('//saml:AuthenticationStatement/saml:Subject/saml:NameIdentifier', saml: ASSERTION).text()
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
29
35
|
# A hash of all the attributes with the response.
|
30
36
|
# Assuming there is only one value for each key
|
31
37
|
def attributes
|
32
38
|
@attributes ||= begin
|
33
39
|
attrs = {
|
34
40
|
'not_valid_before' => not_valid_before,
|
35
|
-
'not_valid_on_or_after' => not_valid_on_or_after
|
41
|
+
'not_valid_on_or_after' => not_valid_on_or_after,
|
42
|
+
'historical_privatepersonalidentifier' => []
|
36
43
|
}
|
37
44
|
|
38
45
|
stmt_elements = xml.xpath('//a:Attribute', a: ASSERTION)
|
39
46
|
return attrs if stmt_elements.nil?
|
40
47
|
|
41
48
|
stmt_elements.each_with_object(attrs) do |element, result|
|
42
|
-
name
|
49
|
+
name = element.attribute('AttributeName').value
|
43
50
|
value = element.text
|
44
51
|
|
45
|
-
|
52
|
+
case name
|
53
|
+
when 'privatepersonalidentifier' # person can change their identifier, service will return all the versions
|
54
|
+
if element.attribute('OriginalIssuer') # this is the primary identifier, as returned by third party auth service
|
55
|
+
result[name] = value
|
56
|
+
else
|
57
|
+
result['historical_privatepersonalidentifier'] << value
|
58
|
+
end
|
59
|
+
else
|
60
|
+
result[name] = value
|
61
|
+
end
|
46
62
|
end
|
47
63
|
end
|
48
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-latvija
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edgars Beigarts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
172
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.6
|
173
|
+
rubygems_version: 2.7.6
|
174
174
|
signing_key:
|
175
175
|
specification_version: 4
|
176
176
|
summary: Latvija.lv authentication strategy for OmniAuth
|