1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
from django.conf import settings
METADATA = 'http://md.swamid.se/md/swamid-1.0.xml'
AUTH_PROFILE_MODULE = 'userprofile.UserProfile'
#SAML_KEY = "/etc/ssl/private/ssl-cert-snakeoil.key"
#SAML_CERT = "/etc/ssl/certs/ssl-cert-snakeoil.pem"
LOGIN_URL = '/saml2/login/'
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
def asgard_sp_config(request):
return {
# your entity id, usually your subdomain plus the url to the metadata view
'entityid': 'https://coip.app.nordu.net/saml2/metadata',
# directory with attribute mapping
"attribute_map_dir" : "%s/saml2/attributemaps" % settings.BASE_DIR,
# this block states what services we provide
'service': {
# we are just a lonely SP
'sp' : {
'name': 'COIP',
'endpoints': {
# url and binding to the assertion consumer service view
# do not change the binding osettingsr service name
'assertion_consumer_service': [
('https://coip.app.nordu.net/saml2/acs/',
saml2.BINDING_HTTP_POST),
],
# url and binding to the single logout service view
# do not change the binding or service name
'single_logout_service': [
('https://coip.app.nordu.net/saml2/ls/',
saml2.BINDING_HTTP_REDIRECT),
],
},
# attributes that this project need to identify a user
'required_attributes': ['eduPersonPrincipalName','displayName'],
# attributes that may be useful to have but not required
'optional_attributes': ['eduPersonAffiliation'],
}
},
# where the remote metadata is stored
'metadata': { 'local': ['/tmp/swamid-idp.xml'] },
# set to 1 to output debugging information
'debug': 1,
# certificate
"key_file" : "%s/%s.key" % (settings.SSL_KEY_DIR,host),
"cert_file" : "%s/%s.crt" % (settings.SSL_CRT_DIR,host),
# own metadata settings
'contact_person': [
{'given_name': 'Leif',
'sur_name': 'Johansson',
'company': 'NORDUnet',
'email_address': 'leifj@nordu.net',
'contact_type': 'technical'},
],
# you can set multilanguage information here
'organization': {
'name': [('NORDUNet', 'en')],
'display_name': [('NORDUnet A/S', 'en')],
'url': [('http://www.nordu.net', 'en')],
},
'valid_for': 24, # how long is our metadata valid
}
SAML_CONFIG_GENERATOR = asgard_sp_config
|