Skip to content

Commit a30e51c

Browse files
Merge pull request #698 from johanlundberg/lundberg_entity_category_and_attribute_mapping
Add SwedenConnect attribute mapping and SWAMID entity category
2 parents ca27b12 + b499627 commit a30e51c

File tree

2 files changed

+110
-23
lines changed

2 files changed

+110
-23
lines changed

src/saml2/attributemaps/saml_uri.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,32 @@
3232
# https://github.com/Umbrella-Commiters/UmbrellaIdP3/blob/master/schema/99-user.ldif
3333
UMBRELLA_EAAUser_ID = 'urn:oid:1.3.6.1.4.1.42750.1.1.'
3434

35+
# INERA specification
36+
# Closet public spec source I could find, sadly in swedish
37+
# https://www.sambi.se/wordpress/wp-content/uploads/2017/06/Sambi_Attributspecifikation_1.1.pdf
38+
INERA_OID = 'urn:oid:1.2.752.29.4.'
39+
40+
# DIGG specification
41+
# https://docs.swedenconnect.se/technical-framework/latest/ELN-0604_-_Attribute_Specification_for_the_Swedish_eID_Framework.html
42+
DIGG_OID = 'urn:oid:1.2.752.201.3.'
43+
3544
MAP = {
3645
'identifier': 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
3746
'fro': {
47+
DIGG_OID + '1': 'orgAffiliation',
48+
DIGG_OID + '2': 'transactionIdentifier',
49+
DIGG_OID + '3': 'authContextParams',
50+
DIGG_OID + '4': 'prid',
51+
DIGG_OID + '5': 'pridPersistence',
52+
DIGG_OID + '6': 'personalIdentityNumberBinding',
53+
DIGG_OID + '7': 'eidasPersonIdentifier',
54+
DIGG_OID + '8': 'birthName',
55+
DIGG_OID + '9': 'eidasNaturalPersonAddress',
56+
DIGG_OID + '10': 'userCertificate',
57+
DIGG_OID + '11': 'userSignature',
58+
DIGG_OID + '12': 'sad',
59+
DIGG_OID + '13': 'authServerSignature',
60+
DIGG_OID + '14': 'signMessageDigest',
3861
EIDAS_LEGALPERSON+'LegalPersonIdentifier': 'LegalPersonIdentifier',
3962
EIDAS_LEGALPERSON+'LegalPersonAddress': 'LegalAddress',
4063
EIDAS_LEGALPERSON+'LegalName': 'LegalName',
@@ -71,6 +94,8 @@
7194
EDUPERSON_OID+'12': 'eduPersonPrincipalNamePrior',
7295
EDUPERSON_OID+'13': 'eduPersonUniqueId',
7396
EDUPERSON_OID+'16': 'eduPersonOrcid',
97+
INERA_OID + '1': 'employeeHsaId',
98+
INERA_OID + '13': 'personalIdentityNumber',
7499
LDAPGVAT_OID+'1': 'PVP-GID',
75100
LDAPGVAT_OID+'149': 'PVP-BPK',
76101
LDAPGVAT_OID+'153': 'PVP-OU-OKZ',
@@ -237,7 +262,10 @@
237262
'CurrentAddress': EIDAS_NATURALPERSON+'CurrentAddress',
238263
'Gender': EIDAS_NATURALPERSON+'Gender',
239264
'associatedDomain': UCL_DIR_PILOT+'37',
265+
'authContextParams': DIGG_OID+'3',
240266
'authorityRevocationList': X500ATTR_OID+'38',
267+
'authServerSignature': DIGG_OID+'13',
268+
'birthName': DIGG_OID+'8',
241269
'businessCategory': X500ATTR_OID+'15',
242270
'c': X500ATTR_OID+'6',
243271
'cACertificate': X500ATTR_OID+'37',
@@ -271,7 +299,10 @@
271299
'eduPersonAssurance': EDUPERSON_OID+'11',
272300
'eduPersonUniqueId': EDUPERSON_OID+'13',
273301
'eduPersonOrcid': EDUPERSON_OID+'16',
302+
'eidasNaturalPersonAddress': DIGG_OID+'9',
303+
'eidasPersonIdentifier': DIGG_OID+'7',
274304
'email': PKCS_9+'1',
305+
'employeeHsaId': INERA_OID+'1',
275306
'employeeNumber': NETSCAPE_LDAP+'3',
276307
'employeeType': NETSCAPE_LDAP+'4',
277308
'enhancedSearchGuide': X500ATTR_OID+'47',
@@ -309,15 +340,20 @@
309340
'osiOtherHomePhone': OPENOSI_OID+'109',
310341
'osiWorkURL': OPENOSI_OID+'120',
311342
'ou': X500ATTR_OID+'11',
343+
'orgAffiliation': DIGG_OID+'1',
312344
'owner': X500ATTR_OID+'32',
313345
'pairwise-id': SAML_SUBJECT_ID+'pairwise-id',
346+
'personalIdentityNumber': INERA_OID+'13',
347+
'personalIdentityNumberBinding': DIGG_OID+'6',
314348
'physicalDeliveryOfficeName': X500ATTR_OID+'19',
315349
'postOfficeBox': X500ATTR_OID+'18',
316350
'postalAddress': X500ATTR_OID+'16',
317351
'postalCode': X500ATTR_OID+'17',
318352
'preferredDeliveryMethod': X500ATTR_OID+'28',
319353
'preferredLanguage': NETSCAPE_LDAP+'39',
320354
'presentationAddress': X500ATTR_OID+'29',
355+
'prid': DIGG_OID+'4',
356+
'pridPersistence': DIGG_OID+'5',
321357
'protocolInformation': X500ATTR_OID+'48',
322358
'pseudonym': X500ATTR_OID+'65',
323359
'PVP-USERID': LDAPGVAT_UCL_DIR_PILOT+'1',
@@ -341,6 +377,7 @@
341377
'PVP-GIVENNAME': LDAPGVAT_X500ATTR_OID+'42',
342378
'registeredAddress': X500ATTR_OID+'26',
343379
'roleOccupant': X500ATTR_OID+'33',
380+
'sad': DIGG_OID+'12',
344381
'schacCountryOfCitizenship': SCHAC+'5',
345382
'schacCountryOfResidence': SCHAC+'11',
346383
'schacDateOfBirth': SCHAC+'3',
@@ -363,6 +400,7 @@
363400
'schacUserStatus': SCHAC+'19',
364401
'searchGuide': X500ATTR_OID+'14',
365402
'serialNumber': X500ATTR_OID+'5',
403+
'signMessageDigest': DIGG_OID+'14',
366404
'sisLegalGuardianFor': SIS+'1',
367405
'sisSchoolGrade': SIS+'2',
368406
'sn': X500ATTR_OID+'4',
@@ -375,11 +413,14 @@
375413
'teletexTerminalIdentifier': X500ATTR_OID+'22',
376414
'telexNumber': X500ATTR_OID+'21',
377415
'title': X500ATTR_OID+'12',
416+
'transactionIdentifier': DIGG_OID+'2',
378417
'uid': UCL_DIR_PILOT+'1',
379418
'uniqueMember': X500ATTR_OID+'50',
380419
'userCertificate': X500ATTR_OID+'36',
420+
# 'userCertificate': DIGG_OID+'10',
381421
'userPKCS12': NETSCAPE_LDAP+'216',
382422
'userSMIMECertificate': NETSCAPE_LDAP+'40',
423+
'userSignature': DIGG_OID+'11',
383424
'x121Address': X500ATTR_OID+'24',
384425
'x500UniqueIdentifier': X500ATTR_OID+'45',
385426
'swissEduPersonUniqueID': SWISSEDUPERSON_OID+'1',

src/saml2/entity_category/swamid.py

Lines changed: 69 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,81 @@
11
__author__ = 'rolandh'
22

3-
NAME = ["givenName", "displayName", "sn", "cn"]
4-
STATIC_ORG_INFO = ["c", "o", "co", "norEduOrgAcronym", "schacHomeOrganization",
5-
'schacHomeOrganizationType']
6-
OTHER = ["eduPersonPrincipalName", "eduPersonScopedAffiliation", "mail",
7-
"eduPersonAssurance"]
8-
9-
R_AND_S = ['eduPersonTargetedID',
10-
'eduPersonPrincipalName',
11-
'mail',
12-
'displayName',
13-
'givenName',
14-
'sn',
15-
'eduPersonScopedAffiliation'
16-
]
3+
NAME = [
4+
'givenName',
5+
'displayName',
6+
'sn',
7+
'cn',
8+
]
9+
10+
STATIC_ORG_INFO = [
11+
'c',
12+
'o',
13+
'co',
14+
'norEduOrgAcronym',
15+
'schacHomeOrganization',
16+
'schacHomeOrganizationType',
17+
]
18+
19+
OTHER = [
20+
'eduPersonPrincipalName',
21+
'eduPersonScopedAffiliation',
22+
'mail',
23+
'eduPersonAssurance'
24+
]
25+
26+
R_AND_S = [
27+
'eduPersonTargetedID',
28+
'eduPersonPrincipalName',
29+
'eduPersonUniqueID',
30+
'mail',
31+
'displayName',
32+
'givenName',
33+
'sn',
34+
'eduPersonAssurance',
35+
'eduPersonScopedAffiliation'
36+
]
37+
38+
GEANT_COCO = [
39+
'eduPersonTargetedID',
40+
'eduPersonPrincipalName',
41+
'eduPersonUniqueID',
42+
'eduPersonOrcid',
43+
'norEduPersonNIN',
44+
'personalIdentityNumber',
45+
'schacDateOfBirth',
46+
'mail',
47+
'displayName',
48+
'cn',
49+
'givenName',
50+
'sn',
51+
'eduPersonAssurance',
52+
'eduPersonScopedAffiliation',
53+
'eduPersonAffiliation',
54+
'o',
55+
'norEduOrgAcronym',
56+
'c',
57+
'co',
58+
'schacHomeOrganization',
59+
'schacHomeOrganizationType',
60+
]
1761

1862
# These give you access to information
19-
RESEARCH_AND_EDUCATION = "http://www.swamid.se/category/research-and-education"
20-
SFS_1993_1153 = "http://www.swamid.se/category/sfs-1993-1153"
21-
RESEARCH_AND_SCHOLARSHIP = "http://refeds.org/category/research-and-scholarship"
63+
RESEARCH_AND_EDUCATION = 'http://www.swamid.se/category/research-and-education' # Deprecated from 2021-03-31
64+
SFS_1993_1153 = 'http://www.swamid.se/category/sfs-1993-1153' # Deprecated from 2021-03-31
65+
RESEARCH_AND_SCHOLARSHIP = 'http://refeds.org/category/research-and-scholarship'
66+
COCO = 'http://www.geant.net/uri/dataprotection-code-of-conduct/v1'
2267

2368
# presently these don't by themself
24-
EU = "http://www.swamid.se/category/eu-adequate-protection"
25-
NREN = "http://www.swamid.se/category/nren-service"
26-
HEI = "http://www.swamid.se/category/hei-service"
69+
EU = 'http://www.swamid.se/category/eu-adequate-protection' # Deprecated from 2021-03-31
70+
NREN = 'http://www.swamid.se/category/nren-service' # Deprecated from 2021-03-31
71+
HEI = 'http://www.swamid.se/category/hei-service' # Deprecated from 2021-03-31
2772

2873
RELEASE = {
29-
"": ["eduPersonTargetedID"],
30-
SFS_1993_1153: ["norEduPersonNIN", "eduPersonAssurance"],
74+
'': ['eduPersonTargetedID'],
75+
SFS_1993_1153: ['norEduPersonNIN', 'eduPersonAssurance'],
3176
(RESEARCH_AND_EDUCATION, EU): NAME + STATIC_ORG_INFO + OTHER,
3277
(RESEARCH_AND_EDUCATION, NREN): NAME + STATIC_ORG_INFO + OTHER,
3378
(RESEARCH_AND_EDUCATION, HEI): NAME + STATIC_ORG_INFO + OTHER,
3479
RESEARCH_AND_SCHOLARSHIP: R_AND_S,
35-
}
80+
COCO: GEANT_COCO,
81+
}

0 commit comments

Comments
 (0)