Revision 2cd99e7a aai/shibboleth.py
b/aai/shibboleth.py | ||
---|---|---|
6 | 6 |
|
7 | 7 |
from synnefo.logic import users |
8 | 8 |
|
9 |
|
|
9 | 10 |
class Tokens: |
10 | 11 |
SIB_NAME = "Shib-InetOrgPerson-givenName" |
11 | 12 |
SIB_SURNAME = "Shib-Person-surname" |
... | ... | |
17 | 18 |
SIB_GR_EDU_PERSON_UNDERGRADUATE_BRANCH = "grEduPersonUndergraduateBranch" |
18 | 19 |
SIB_SESSION_ID = "Shib-Session-ID" |
19 | 20 |
|
20 |
class NoUniqueToken(object):
|
|
21 |
class NoUniqueToken(BaseException):
|
|
21 | 22 |
|
22 | 23 |
def __init__(self, msg): |
23 | 24 |
self.msg = msg |
24 |
|
|
25 |
pass |
|
26 | 25 |
|
27 |
class NoRealName(object):
|
|
26 |
class NoRealName(BaseException):
|
|
28 | 27 |
|
29 | 28 |
def __init__(self, msg): |
30 | 29 |
self.msg = msg |
31 | 30 |
|
32 |
pass |
|
33 |
|
|
34 | 31 |
def register_shibboleth_user(tokens): |
35 | 32 |
"""Registers a sibbolleth user using the input hash as a source for data. |
36 | 33 |
The token requirements are described in: |
... | ... | |
61 | 58 |
raise NoRealName("Authentication does not return the user's name") |
62 | 59 |
|
63 | 60 |
if is_student: |
64 |
users.register_student(realname, '' ,unq) |
|
61 |
users.register_student(realname, '' , unq)
|
|
65 | 62 |
else: |
66 |
users.register_professor(realname, '' ,unq) |
|
63 |
users.register_professor(realname, '' , unq)
|
|
67 | 64 |
|
68 | 65 |
return True |
Also available in: Unified diff