Revision 63efc637 aai/shibboleth.py
b/aai/shibboleth.py | ||
---|---|---|
7 | 7 |
from synnefo.logic import users |
8 | 8 |
|
9 | 9 |
class Tokens: |
10 |
SIB_GIVEN_NAME = "shib_inetorgperson_givenname"
|
|
11 |
SIB_SN = "shib_person_surname"
|
|
12 |
SIB_CN = "cn"
|
|
10 |
SIB_NAME = "Shib-InetOrgPerson-givenName"
|
|
11 |
SIB_SURNAME = "Shib-Person-surname"
|
|
12 |
SIB_CN = "Shib-Person-commonName"
|
|
13 | 13 |
SIB_DISPLAY_NAME = "displayName" |
14 |
SIB_EDU_PERSON_PRINCIPAL_NAME = "eppn"
|
|
14 |
SIB_EPPN = "eppn"
|
|
15 | 15 |
SIB_EDU_PERSON_AFFILIATION = "shib_ep_primaryaffiliation" |
16 | 16 |
SIB_SCHAC_PERSONAL_UNIQUE_CODE = "schacPersonalUniqueCode" |
17 | 17 |
SIB_GR_EDU_PERSON_UNDERGRADUATE_BRANCH = "grEduPersonUndergraduateBranch" |
... | ... | |
36 | 36 |
http://aai.grnet.gr/policy |
37 | 37 |
""" |
38 | 38 |
realname = None |
39 |
print tokens |
|
39 | 40 |
|
40 |
if Tokens.SIB_GIVEN_NAME in tokens:
|
|
41 |
realname = tokens[Tokens.SIB_GIVEN_NAME]
|
|
41 |
if Tokens.SIB_SURNAME in tokens:
|
|
42 |
realname = tokens[Tokens.SIB_SURNAME]
|
|
42 | 43 |
|
43 |
if Tokens.SIB_DISPLAY_NAME in tokens: |
|
44 |
realname = tokens[Tokens.SIB_DISPLAY_NAME] |
|
44 |
if Tokens.SIB_NAME in tokens: |
|
45 |
realname = tokens[Tokens.SIB_NAME] + ' ' + realname |
|
46 |
|
|
47 |
if Tokens.SIB_CN in tokens: |
|
48 |
realname = tokens[Tokens.SIB_CN] |
|
45 | 49 |
|
46 | 50 |
is_student = Tokens.SIB_SCHAC_PERSONAL_UNIQUE_CODE in tokens or \ |
47 | 51 |
Tokens.SIB_GR_EDU_PERSON_UNDERGRADUATE_BRANCH in tokens |
48 | 52 |
|
49 |
unq = tokens.get(Tokens.SIB_EDU_PERSON_PRINCIPAL_NAME)
|
|
53 |
unq = tokens.get(Tokens.SIB_EPPN)
|
|
50 | 54 |
|
51 | 55 |
if unq is None: |
52 | 56 |
raise NoUniqueToken("Authentication does not return a unique token") |
... | ... | |
59 | 63 |
else: |
60 | 64 |
users.register_professor(realname, '' ,unq) |
61 | 65 |
|
62 |
return True |
|
66 |
return True |
Also available in: Unified diff