summaryrefslogtreecommitdiffstats
path: root/authentic2_idp_cas/constants.py
blob: b90c10b0f8f4bc185b99b1667fb92c2ff7820c4d (plain)
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
# Constants #
CAS_NAMESPACE    = 'http://www.yale.edu/tp/cas'
RENEW_PARAM      = 'renew'
SERVICE_PARAM    = 'service'
GATEWAY_PARAM    = 'gateway'
WARN_PARAM       = 'warn'
URL_PARAM        = 'url'
TICKET_PARAM     = 'ticket'
PGT_URL_PARAM    = 'pgtUrl'
PGT_PARAM        = 'pgt'
PGT_ID_PARAM     = 'pgtId'
PGT_IOU_PARAM    = 'pgtIou'
TARGET_SERVICE_PARAM = 'targetService'
USERNAME_FIELD   = 'username' # unused
PASSWORD_FIELD   = 'password' # unused
LT_FIELD         = 'lt'       # unused
SERVICE_TICKET_PREFIX = 'ST-'
ID_PARAM         = 'id'
CANCEL_PARAM     = 'cancel'

# ERROR codes
INVALID_REQUEST_ERROR  = 'INVALID_REQUEST'
INVALID_TICKET_ERROR   = 'INVALID_TICKET'
INVALID_SERVICE_ERROR  = 'INVALID_SERVICE'
INTERNAL_ERROR         = 'INTERNAL_ERROR'
BAD_PGT_ERROR          = 'BAD_PGT'

# XML Elements for CAS 2.0
SERVICE_RESPONSE_ELT       = 'serviceResponse'

AUTHENTICATION_SUCCESS_ELT = 'authenticationSuccess'
USER_ELT                   = 'user'
PGT_ELT                    = 'proxyGrantingTicket'
PROXIES_ELT                = 'proxies'
PROXY_ELT                  = 'proxy'

AUTHENTICATION_FAILURE_ELT = 'authenticationFailure'
CODE_ELT                   = 'code'

PROXY_SUCCESS_ELT          = 'proxySuccess'
PROXY_TICKET_ELT           = 'proxyTicket'

PROXY_FAILURE_ELT          = 'proxyFailure'

# Templates

CAS10_VALIDATION_FAILURE = 'no\n\n'
CAS10_VALIDATION_SUCCESS = 'yes\n%s\n'
CAS20_VALIDATION_FAILURE = '''<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
    <cas:authenticationFailure code="%s">
        %s
    </cas:authenticationFailure>
</cas:serviceResponse>'''
CAS20_VALIDATION_SUCCESS = '''<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
    <cas:authenticationSuccess>
        <cas:user>%s</cas:user>
    </cas:authenticationSuccess>
</cas:serviceResponse>'''