omniauth-mpassid 0.5.1 → 0.6.1
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/README.md +104 -63
- data/lib/omniauth/strategies/mpassid.rb +78 -107
- data/lib/omniauth-mpassid/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 50b9b5c7f66fc026d4c99975dacd6b4ed74fa375eeaaf9cac28b3d326bf16d3e
|
|
4
|
+
data.tar.gz: 6181a71513c88a33ebfb549a1b4f3a596e892e1e4e24fbf78f783df7313e5507
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 073c27bedb1e4cbb13b5f40fc5683bea48507bf348ac69e32eb585d2d127d78ddc6ea9bf1dda0945189001562967ff24382da382bd825d3357fe8653ac8d2c56
|
|
7
|
+
data.tar.gz: 5c30c4c96e99c713872f79b64ed3a3c80787d0a014902f766b47b2abc17c06975802e86b2319bed393f62211d623b65c07282cbe6b0d159065cfc14e4ecdb152
|
data/README.md
CHANGED
|
@@ -84,6 +84,13 @@ Devise.setup do |config|
|
|
|
84
84
|
end
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
## Testing
|
|
88
|
+
|
|
89
|
+
Once the gem is installed and configured properly, it can be tested with the
|
|
90
|
+
test accounts available at:
|
|
91
|
+
|
|
92
|
+
https://wiki.eduuni.fi/display/OPHPALV/Test+accounts+available+for+testing
|
|
93
|
+
|
|
87
94
|
## Identification Responses
|
|
88
95
|
|
|
89
96
|
The user's data is transmitted from MPASSid in the SAML authentication
|
|
@@ -109,12 +116,11 @@ The user's personal information transmitted from MPASSid can be found under
|
|
|
109
116
|
the `:saml_attributes` key in the OmniAuth extra hash described above.
|
|
110
117
|
|
|
111
118
|
This attributes hash will contain the keys described in this following
|
|
112
|
-
sub-sections.
|
|
113
|
-
MPASSid's own documentation but are available at least in some SAML responses.
|
|
119
|
+
sub-sections.
|
|
114
120
|
|
|
115
121
|
See also the MPASSid data models documentation for more information:
|
|
116
122
|
|
|
117
|
-
https://wiki.eduuni.fi/display/
|
|
123
|
+
https://wiki.eduuni.fi/display/OPHPALV/MPASSid%3An+tietomalli
|
|
118
124
|
|
|
119
125
|
The attributes can be either single or multi type defining whether they can
|
|
120
126
|
have a single or multiple values. The single type values are strings and multi
|
|
@@ -128,15 +134,15 @@ is `nil` for both types.
|
|
|
128
134
|
- SAML FriendlyName: givenName
|
|
129
135
|
- Type: Single (`String`)
|
|
130
136
|
|
|
131
|
-
The
|
|
137
|
+
The given name of the user.
|
|
132
138
|
|
|
133
|
-
#### `:
|
|
139
|
+
#### `:first_name`
|
|
134
140
|
|
|
135
|
-
- SAML URI:
|
|
136
|
-
- SAML FriendlyName:
|
|
141
|
+
- SAML URI: urn:mpass.id:nickname
|
|
142
|
+
- SAML FriendlyName: nickname
|
|
137
143
|
- Type: Single (`String`)
|
|
138
144
|
|
|
139
|
-
|
|
145
|
+
The first name / calling name / nickname of the user.
|
|
140
146
|
|
|
141
147
|
#### `:last_name`
|
|
142
148
|
|
|
@@ -146,39 +152,45 @@ All the first/given names of the user.
|
|
|
146
152
|
|
|
147
153
|
The last/family name of the user.
|
|
148
154
|
|
|
149
|
-
#### `:
|
|
155
|
+
#### `:provider_info`
|
|
150
156
|
|
|
151
|
-
- SAML URI: urn:mpass.id:
|
|
152
|
-
- SAML FriendlyName:
|
|
153
|
-
- Type: Multi (`Array
|
|
157
|
+
- SAML URI: urn:mpass.id:educationProviderInfo
|
|
158
|
+
- SAML FriendlyName: mpassEducationProviderInfo
|
|
159
|
+
- Type: Multi (`Array<String>`)
|
|
154
160
|
|
|
155
|
-
|
|
161
|
+
Information about the educational provider, each value contains multiple fields
|
|
162
|
+
separated with a semicolon (`;`) character.
|
|
156
163
|
|
|
157
|
-
|
|
164
|
+
For instance `1.2.246.562.10.494695390410;Virallinen nimi`.
|
|
158
165
|
|
|
159
|
-
|
|
166
|
+
The description of the fields:
|
|
160
167
|
|
|
161
|
-
|
|
168
|
+
1. The educational provider's OID as specified at the link below (`KOULUTUSTOIMIJA`)
|
|
169
|
+
2. The educational provider's name as specified at the link below
|
|
162
170
|
|
|
163
|
-
|
|
164
|
-
* urn:mpass.id:municipality
|
|
165
|
-
* urn:educloudalliance.org:municipality
|
|
166
|
-
- SAML FriendlyName: one of the following (first found attribute)
|
|
167
|
-
* N/A
|
|
168
|
-
* ecaMunicipality
|
|
169
|
-
- Type: Multi (`Array`)
|
|
171
|
+
The OIDs and information for these OIDs can be found from:
|
|
170
172
|
|
|
171
|
-
|
|
173
|
+
https://virkailija.opintopolku.fi/organisaatio-service/swagger-ui/index.html
|
|
172
174
|
|
|
173
|
-
#### `:
|
|
175
|
+
#### `:school_info`
|
|
174
176
|
|
|
175
|
-
- SAML URI: urn:mpass.id:
|
|
176
|
-
- SAML FriendlyName:
|
|
177
|
-
- Type: Multi (`Array
|
|
177
|
+
- SAML URI: urn:mpass.id:schoolInfo
|
|
178
|
+
- SAML FriendlyName: mpassSchoolInfo
|
|
179
|
+
- Type: Multi (`Array<String>`)
|
|
180
|
+
|
|
181
|
+
Information about the school, each value contains multiple fields separated with
|
|
182
|
+
a semicolon (`;`) character.
|
|
178
183
|
|
|
179
|
-
The
|
|
184
|
+
The values are provided in both of the following formats as separate values:
|
|
180
185
|
|
|
181
|
-
|
|
186
|
+
- `30076;Mansikkalan testi peruskoulu`
|
|
187
|
+
- `1.2.246.562.99.00000000002;Mansikkalan testi peruskoulu`
|
|
188
|
+
|
|
189
|
+
##### First format
|
|
190
|
+
|
|
191
|
+
The first value format specifies the national educational institution code as
|
|
192
|
+
the first column separated with a semicolon (`;`) as specified at the national
|
|
193
|
+
educational institution registry.
|
|
182
194
|
|
|
183
195
|
For the list of codes, see:
|
|
184
196
|
|
|
@@ -189,37 +201,57 @@ An example for a single school code (04647), JSON format:
|
|
|
189
201
|
|
|
190
202
|
https://virkailija.opintopolku.fi/koodisto-service/rest/codeelement/oppilaitosnumero_04647
|
|
191
203
|
|
|
192
|
-
|
|
204
|
+
##### Second format
|
|
193
205
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
206
|
+
The second value format specifies the OID of the educational institution as
|
|
207
|
+
the first column separated with a semicolon (`;`). These values are specified
|
|
208
|
+
at (filter with `OPPILAITOS`):
|
|
197
209
|
|
|
198
|
-
|
|
210
|
+
https://virkailija.opintopolku.fi/organisaatio-service/swagger-ui/index.html
|
|
199
211
|
|
|
200
|
-
#### `:
|
|
212
|
+
#### `:class_level`
|
|
201
213
|
|
|
202
|
-
- SAML URI:
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
- SAML FriendlyName: one of the following (first found attribute)
|
|
206
|
-
* N/A
|
|
207
|
-
* ecaGroup
|
|
208
|
-
- Type: Multi (`Array`)
|
|
214
|
+
- SAML URI: urn:mpass.id:classLevel
|
|
215
|
+
- SAML FriendlyName: N/A
|
|
216
|
+
- Type: Single (`String`)
|
|
209
217
|
|
|
210
|
-
The class
|
|
218
|
+
The class level information (0-10) of the authenticated user.
|
|
211
219
|
|
|
212
|
-
For instance
|
|
220
|
+
For instance 8 or 3.
|
|
213
221
|
|
|
214
|
-
|
|
222
|
+
For further information, see:
|
|
223
|
+
|
|
224
|
+
https://www.stat.fi/meta/kas/vuosiluokka.html
|
|
225
|
+
|
|
226
|
+
This information is available for pre-primary education and comprehensive
|
|
227
|
+
education students.
|
|
228
|
+
|
|
229
|
+
This information is not available for secondary level students (upper secondary
|
|
230
|
+
education or vocational education).
|
|
231
|
+
|
|
232
|
+
#### `:learning_materials_charge`
|
|
215
233
|
|
|
216
234
|
- SAML URI: urn:mpass.id:classLevel
|
|
217
235
|
- SAML FriendlyName: N/A
|
|
218
|
-
- Type: Multi (`Array
|
|
236
|
+
- Type: Multi (`Array<String>`)
|
|
219
237
|
|
|
220
|
-
|
|
238
|
+
Specifies for secondary level education pupils whether their learning materials
|
|
239
|
+
are paid or not, each value contains multiple fields separated with a semicolon
|
|
240
|
+
(`;`) character.
|
|
221
241
|
|
|
222
|
-
|
|
242
|
+
The values are provided in both of the following formats as separate values:
|
|
243
|
+
|
|
244
|
+
- `0;00000`
|
|
245
|
+
- `0;1.2.246.562.99.00000000003`
|
|
246
|
+
|
|
247
|
+
Similarly to the `:school_info` field, the values are provided with the national
|
|
248
|
+
educational institution code as well as the educational institution's OID.
|
|
249
|
+
|
|
250
|
+
The first column specifies the value for the field which is explained as
|
|
251
|
+
follows:
|
|
252
|
+
|
|
253
|
+
- `0` = Learning material is free for the pupil
|
|
254
|
+
- `1` = Learning material is paid for the pupil
|
|
223
255
|
|
|
224
256
|
#### `:role`
|
|
225
257
|
|
|
@@ -229,33 +261,34 @@ For instance 8 or 3.
|
|
|
229
261
|
- SAML FriendlyName: one of the following (first found attribute)
|
|
230
262
|
* N/A
|
|
231
263
|
* ecaStructuredRole
|
|
232
|
-
- Type: Multi (`Array
|
|
264
|
+
- Type: Multi (`Array<String>`)
|
|
233
265
|
|
|
234
266
|
The roles of the user in four parts, divided with a semicolon (;) character.
|
|
235
267
|
First municipality, followed by school code, group and role in the group.
|
|
236
268
|
|
|
237
|
-
For instance
|
|
269
|
+
For instance `1.2.246.562.99.00000000001;00000;1A;Oppilas;1;1.2.246.562.99.00000000003;`.
|
|
238
270
|
|
|
239
|
-
|
|
271
|
+
Each value consists of the following fields:
|
|
240
272
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
273
|
+
1. Educational provider OID (e.g. `1.2.246.562.99.00000000001`)
|
|
274
|
+
2. National educational institution code (e.g. `00000`)
|
|
275
|
+
3. Class or group information of the pupil (e.g. `1A`)
|
|
276
|
+
4. Role of the user (e.g. `Oppilas`)
|
|
277
|
+
5. Role code of the user (e.g. `1`)
|
|
278
|
+
6. Educational institution OID (e.g. `1.2.246.562.99.00000000003`)
|
|
279
|
+
7. The office / branch OID (similar format as other OIDs, can be also empty)
|
|
244
280
|
|
|
245
|
-
|
|
281
|
+
The OIDs for the educational provider (`KOULUTUSTOIMIJA`), educational
|
|
282
|
+
institution (`OPPILAITOS`) and office / branch (`TOIMIPISTE`) can be found from:
|
|
246
283
|
|
|
247
|
-
|
|
284
|
+
https://virkailija.opintopolku.fi/organisaatio-service/swagger-ui/index.html
|
|
248
285
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
#### `:funet_person_learner_id` (undocumented)
|
|
286
|
+
#### `:learner_id`
|
|
252
287
|
|
|
253
288
|
- SAML URI: urn:oid:1.3.6.1.4.1.16161.1.1.27
|
|
254
|
-
- SAML FriendlyName:
|
|
289
|
+
- SAML FriendlyName: learnerId
|
|
255
290
|
- Type: Single (`String`)
|
|
256
291
|
|
|
257
|
-
NOTE: This attribute is undocumented by MPASSid.
|
|
258
|
-
|
|
259
292
|
11-digit identifier, which may be used to identify a person while storing,
|
|
260
293
|
managing or transferring personal data.
|
|
261
294
|
|
|
@@ -263,6 +296,14 @@ See:
|
|
|
263
296
|
|
|
264
297
|
https://wiki.eduuni.fi/display/CSCHAKA/funetEduPersonSchema2dot2#funetEduPersonSchema2dot2-funetEduPersonLearnerId
|
|
265
298
|
|
|
299
|
+
#### `:original_issuer`
|
|
300
|
+
|
|
301
|
+
Information about the user's home organization that is relying the information
|
|
302
|
+
to MPASSid. This information is added by the Finnish National Agency for
|
|
303
|
+
Education.
|
|
304
|
+
|
|
305
|
+
For instance `1.2.246.562.99.00000000001`.
|
|
306
|
+
|
|
266
307
|
## License
|
|
267
308
|
|
|
268
309
|
MIT, see [LICENSE](LICENSE).
|
|
@@ -39,44 +39,41 @@ module OmniAuth
|
|
|
39
39
|
|
|
40
40
|
# The request attributes for MPASSid
|
|
41
41
|
option :request_attributes, [
|
|
42
|
-
# The
|
|
43
|
-
# identifier for identifying the user. NOTE: will change if the user
|
|
44
|
-
# moves to another user registry.
|
|
45
|
-
# (single value)
|
|
46
|
-
{
|
|
47
|
-
name: 'urn:mpass.id:uid',
|
|
48
|
-
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
49
|
-
friendly_name: 'mpassUsername'
|
|
50
|
-
},
|
|
51
|
-
# Funet EDU person learner ID
|
|
42
|
+
# The last/family name of the user.
|
|
52
43
|
# (single value)
|
|
53
44
|
{
|
|
54
|
-
name: 'urn:oid:
|
|
45
|
+
name: 'urn:oid:2.5.4.4',
|
|
55
46
|
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
56
|
-
friendly_name: '
|
|
47
|
+
friendly_name: 'sn'
|
|
57
48
|
},
|
|
58
|
-
# The
|
|
49
|
+
# The given name of the user.
|
|
59
50
|
# (single value)
|
|
60
51
|
{
|
|
61
52
|
name: 'urn:oid:2.5.4.42',
|
|
62
53
|
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
63
54
|
friendly_name: 'givenName'
|
|
64
55
|
},
|
|
65
|
-
#
|
|
56
|
+
# The first name/nickname of the user (calling name / kutsumanimi).
|
|
66
57
|
# (single value)
|
|
67
58
|
{
|
|
68
|
-
name: '
|
|
59
|
+
name: 'urn:mpass.id:nickname',
|
|
69
60
|
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
70
|
-
friendly_name: '
|
|
61
|
+
friendly_name: 'nickname'
|
|
71
62
|
},
|
|
72
|
-
# The
|
|
63
|
+
# The unique identifier of the authenticated user. Currently recommended
|
|
64
|
+
# identifier for identifying the user. NOTE: will change if the user
|
|
65
|
+
# moves to another user registry.
|
|
73
66
|
# (single value)
|
|
74
67
|
{
|
|
75
|
-
name: 'urn:
|
|
68
|
+
name: 'urn:mpass.id:uid',
|
|
76
69
|
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
77
|
-
friendly_name: '
|
|
70
|
+
friendly_name: 'mpassUsername'
|
|
78
71
|
},
|
|
79
|
-
#
|
|
72
|
+
# Combination of the school code and official name of the educational
|
|
73
|
+
# institution separated with semicolon.
|
|
74
|
+
# For instance: 30076;Mansikkalan testi peruskoulu AND 1.2.246.562.99.00000000002;Mansikkalan testi peruskoulu
|
|
75
|
+
#
|
|
76
|
+
# Contains the school code of the authenticated user. See
|
|
80
77
|
# https://virkailija.opintopolku.fi/koodisto-service/rest/json/oppilaitosnumero/koodi
|
|
81
78
|
# (JSON format)
|
|
82
79
|
# https://virkailija.opintopolku.fi/koodisto-service/rest/oppilaitosnumero/koodi
|
|
@@ -85,93 +82,77 @@ module OmniAuth
|
|
|
85
82
|
# https://virkailija.opintopolku.fi/koodisto-service/rest/codeelement/oppilaitosnumero_04647
|
|
86
83
|
# for school code 04647.
|
|
87
84
|
# (multi value)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
friendly_name: 'mpassSchoolCode'
|
|
92
|
-
},
|
|
93
|
-
# The human-readable name of the school of the authenticated user.
|
|
94
|
-
# (multi value)
|
|
95
|
-
{
|
|
96
|
-
name: 'urn:mpass.id:school',
|
|
97
|
-
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
98
|
-
friendly_name: 'school'
|
|
99
|
-
},
|
|
100
|
-
# Combination of the school code and official name of the educational
|
|
101
|
-
# institution separated with semicolon.
|
|
102
|
-
# For instance: 00000;Tuntematon
|
|
85
|
+
#
|
|
86
|
+
# The OIDs for educational institution (`OPPILAITOS`) can be found from:
|
|
87
|
+
# https://virkailija.opintopolku.fi/organisaatio-service/swagger-ui/index.html
|
|
103
88
|
{
|
|
104
89
|
name: 'urn:mpass.id:schoolInfo',
|
|
105
90
|
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
106
91
|
friendly_name: 'mpassSchoolInfo'
|
|
107
92
|
},
|
|
108
|
-
# The class/group-information of the authenticated user.
|
|
109
|
-
# For instance: 8A or 3B.
|
|
110
|
-
# (multi value)
|
|
111
|
-
{
|
|
112
|
-
name: 'urn:mpass.id:class',
|
|
113
|
-
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
114
|
-
friendly_name: 'mpassClass'
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: 'urn:educloudalliance.org:group',
|
|
118
|
-
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
119
|
-
friendly_name: 'ecaGroup'
|
|
120
|
-
},
|
|
121
93
|
# The class/level-information of the authenticated user.
|
|
122
94
|
# For instance 8 or 3.
|
|
123
|
-
# (
|
|
95
|
+
# (single value)
|
|
124
96
|
{
|
|
125
97
|
name: 'urn:mpass.id:classLevel',
|
|
126
98
|
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
127
99
|
friendly_name: 'mpassClassLevel'
|
|
128
100
|
},
|
|
129
|
-
# The
|
|
130
|
-
# For instance
|
|
101
|
+
# The learning material charge.
|
|
102
|
+
# For instance 0;00000 AND 0;1.2.246.562.99.00000000003.
|
|
131
103
|
# (multi value)
|
|
132
104
|
{
|
|
133
|
-
name: 'urn:
|
|
105
|
+
name: 'urn:mpass.id:learningMaterialsCharge',
|
|
134
106
|
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
135
|
-
friendly_name: '
|
|
107
|
+
friendly_name: 'mpassLearningMaterialsCharge'
|
|
136
108
|
},
|
|
137
109
|
# The role of the user in four parts, divided with a semicolon (;)
|
|
138
110
|
# character. First educational provider's organization OID, followed by
|
|
139
|
-
# school code, group
|
|
140
|
-
#
|
|
111
|
+
# school code, group (e.g. the class), role in the group (e.g.
|
|
112
|
+
# "Oppilas"), the role code (e.g. "1"), the educational institution's
|
|
113
|
+
# OID and finally the office OID (can be undefined).
|
|
114
|
+
# For instance 1.2.246.562.99.00000000001;00000;1A;Oppilas;1;1.2.246.562.99.00000000003;
|
|
141
115
|
# (multi value)
|
|
142
116
|
#
|
|
143
|
-
# The educational providers
|
|
144
|
-
#
|
|
117
|
+
# The OIDs for educational providers (`KOULUTUSTOIMIJA`), educational
|
|
118
|
+
# institutions (`OPPILAITOS`) and offices/branches (`TOIMIPISTE`) can be
|
|
119
|
+
# found from:
|
|
120
|
+
# https://virkailija.opintopolku.fi/organisaatio-service/swagger-ui/index.html
|
|
121
|
+
#
|
|
122
|
+
# The test entries are in:
|
|
123
|
+
# https://github.com/Opetushallitus/aitu/blob/master/ttk-db/resources/db/migration/V12_0__oppilaitosten_puuttuvat_koulutustoimijat.sql
|
|
145
124
|
{
|
|
146
125
|
name: 'urn:mpass.id:role',
|
|
147
126
|
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
148
127
|
friendly_name: 'mpassRole'
|
|
149
128
|
},
|
|
150
|
-
#
|
|
151
|
-
# (
|
|
152
|
-
#
|
|
153
|
-
# The educational providers' organization OIDs can be found from:
|
|
154
|
-
# https://github.com/Opetushallitus/aitu/blob/master/ttk-db/resources/db/migration/V11_2__koulutustoimijat.sql
|
|
155
|
-
{
|
|
156
|
-
name: 'urn:mpass.id:educationProviderId',
|
|
157
|
-
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
158
|
-
friendly_name: 'mpassEducationProviderOid'
|
|
159
|
-
},
|
|
160
|
-
# The educational provider's human-readable name.
|
|
161
|
-
# (multi value)
|
|
129
|
+
# Funet EDU person learner ID
|
|
130
|
+
# (single value)
|
|
162
131
|
{
|
|
163
|
-
name: 'urn:
|
|
132
|
+
name: 'urn:oid:1.3.6.1.4.1.16161.1.1.27',
|
|
164
133
|
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
165
|
-
friendly_name: '
|
|
134
|
+
friendly_name: 'learnerId'
|
|
166
135
|
},
|
|
167
136
|
# Combination of the education provider's organisation-OID and official
|
|
168
137
|
# name. Separated by semicolon.
|
|
169
138
|
# For instance: 1.2.246.562.10.494695390410;Virallinen nimi
|
|
170
139
|
# (multi value)
|
|
140
|
+
#
|
|
141
|
+
# The OIDs for educational providers (`KOULUTUSTOIMIJA`) can be found
|
|
142
|
+
# from:
|
|
143
|
+
# https://virkailija.opintopolku.fi/organisaatio-service/swagger-ui/index.html
|
|
171
144
|
{
|
|
172
145
|
name: 'urn:mpass.id:educationProviderInfo',
|
|
173
146
|
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
174
147
|
friendly_name: 'mpassEducationProviderInfo'
|
|
148
|
+
},
|
|
149
|
+
# The relaying organization for the information.
|
|
150
|
+
# For instance: 1.2.246.562.10.00000000000
|
|
151
|
+
# (single value)
|
|
152
|
+
{
|
|
153
|
+
name: 'urn:mpass.id:originalIssuer',
|
|
154
|
+
name_format: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
|
|
155
|
+
friendly_name: 'originalIssuer'
|
|
175
156
|
}
|
|
176
157
|
]
|
|
177
158
|
|
|
@@ -179,31 +160,35 @@ module OmniAuth
|
|
|
179
160
|
# https://github.com/omniauth/omniauth/wiki/Auth-Hash-Schema#schema-10-and-later
|
|
180
161
|
option(
|
|
181
162
|
:attribute_statements,
|
|
182
|
-
#
|
|
183
|
-
first_name: ['urn:oid:2.5.4.42'
|
|
184
|
-
last_name: ['urn:oid:2.5.4.4']
|
|
185
|
-
# The education provider (e.g. municipality) of the person (literal format in Finnish)
|
|
186
|
-
location: ['urn:mpass.id:educationProvider']
|
|
163
|
+
# First name/calling name or given name (in case first name/calling name is not found)
|
|
164
|
+
first_name: ['urn:mpass.id:nickname', 'urn:oid:2.5.4.42'],
|
|
165
|
+
last_name: ['urn:oid:2.5.4.4']
|
|
187
166
|
)
|
|
188
167
|
|
|
189
168
|
info do
|
|
190
169
|
# Generate the full name to the info hash
|
|
191
170
|
first_name = find_attribute_by(
|
|
192
171
|
[
|
|
193
|
-
'urn:
|
|
194
|
-
'
|
|
172
|
+
'urn:mpass.id:nickname',
|
|
173
|
+
'urn:oid:2.5.4.42'
|
|
195
174
|
]
|
|
196
175
|
)
|
|
197
176
|
last_name = find_attribute_by(['urn:oid:2.5.4.4'])
|
|
198
177
|
display_name = "#{first_name} #{last_name}".strip
|
|
199
|
-
display_name = nil if display_name.length.zero?
|
|
178
|
+
display_name = nil if display_name.length.zero? # rubocop:disable Style/ZeroLengthPredicate
|
|
200
179
|
|
|
201
180
|
found_attributes = [[:name, display_name]]
|
|
202
181
|
|
|
182
|
+
provider = find_attribute_by(['urn:mpass.id:educationProviderInfo'])
|
|
183
|
+
if provider
|
|
184
|
+
provider_parts = provider.split(';')
|
|
185
|
+
found_attributes << [:location, provider_parts[1]] if provider_parts[1]
|
|
186
|
+
end
|
|
187
|
+
|
|
203
188
|
# Default functionality from omniauth-saml
|
|
204
189
|
found_attributes += options.attribute_statements.map do |key, values|
|
|
205
190
|
attribute = find_attribute_by(values)
|
|
206
|
-
[key, attribute]
|
|
191
|
+
[key.to_sym, attribute]
|
|
207
192
|
end
|
|
208
193
|
|
|
209
194
|
found_attributes.to_h
|
|
@@ -222,43 +207,27 @@ module OmniAuth
|
|
|
222
207
|
option(
|
|
223
208
|
:saml_attributes_map,
|
|
224
209
|
given_name: ['urn:oid:2.5.4.42'],
|
|
225
|
-
|
|
210
|
+
first_name: ['urn:mpass.id:nickname'],
|
|
226
211
|
last_name: ['urn:oid:2.5.4.4'],
|
|
227
|
-
|
|
228
|
-
name: ['urn:mpass.id:
|
|
212
|
+
provider_info: {
|
|
213
|
+
name: ['urn:mpass.id:educationProviderInfo'],
|
|
229
214
|
type: :multi
|
|
230
215
|
},
|
|
231
|
-
|
|
232
|
-
name: ['urn:mpass.id:
|
|
216
|
+
school_info: {
|
|
217
|
+
name: ['urn:mpass.id:schoolInfo'],
|
|
233
218
|
type: :multi
|
|
234
219
|
},
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
},
|
|
239
|
-
school_name: {
|
|
240
|
-
name: ['urn:mpass.id:school'],
|
|
241
|
-
type: :multi
|
|
242
|
-
},
|
|
243
|
-
class: {
|
|
244
|
-
name: ['urn:mpass.id:class', 'urn:educloudalliance.org:group'],
|
|
245
|
-
type: :multi
|
|
246
|
-
},
|
|
247
|
-
class_level: {
|
|
248
|
-
name: ['urn:mpass.id:classLevel'],
|
|
220
|
+
class_level: ['urn:mpass.id:classLevel'],
|
|
221
|
+
learning_materials_charge: {
|
|
222
|
+
name: ['urn:mpass.id:learningMaterialsCharge'],
|
|
249
223
|
type: :multi
|
|
250
224
|
},
|
|
251
225
|
role: {
|
|
252
|
-
name: ['urn:mpass.id:role'
|
|
253
|
-
type: :multi
|
|
254
|
-
},
|
|
255
|
-
role_name: {
|
|
256
|
-
name: ['urn:educloudalliance.org:role'],
|
|
226
|
+
name: ['urn:mpass.id:role'],
|
|
257
227
|
type: :multi
|
|
258
228
|
},
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
funet_person_learner_id: ['urn:oid:1.3.6.1.4.1.16161.1.1.27']
|
|
229
|
+
learner_id: ['urn:oid:1.3.6.1.4.1.16161.1.1.27'],
|
|
230
|
+
original_issuer: ['urn:mpass.id:originalIssuer']
|
|
262
231
|
)
|
|
263
232
|
|
|
264
233
|
# Defines the SAML attribute from which to determine the OmniAuth `uid`.
|
|
@@ -297,6 +266,8 @@ module OmniAuth
|
|
|
297
266
|
authn_request = OneLogin::RubySaml::Authrequest.new
|
|
298
267
|
lang = lang_for_authn_request
|
|
299
268
|
|
|
269
|
+
session['saml_redirect_url'] = request.params['redirect_url']
|
|
270
|
+
|
|
300
271
|
with_settings do |settings|
|
|
301
272
|
url = authn_request.create(settings, additional_params_for_authn_request)
|
|
302
273
|
url += "&lang=#{CGI.escape(lang)}" unless lang.nil?
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniauth-mpassid
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Antti Hukkanen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-02-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: omniauth-saml
|
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
150
150
|
- !ruby/object:Gem::Version
|
|
151
151
|
version: '0'
|
|
152
152
|
requirements: []
|
|
153
|
-
rubygems_version: 3.
|
|
153
|
+
rubygems_version: 3.2.33
|
|
154
154
|
signing_key:
|
|
155
155
|
specification_version: 4
|
|
156
156
|
summary: Provides an MPASSid strategy for OmniAuth.
|