Ticket Validation
The application validates the ticket and retrieves user attribute information.
# Request Description
GET https://{your_domain}/api/v1/cas/p3/serviceValidate
# Request Parameters
| Parameter Name | Chinese Name | Required | Example Value | Description |
|---|---|---|---|---|
| service | Callback Address | Yes | The address where the application accepts the ticket. Must match the Application Callback URL configured in the application's CAS settings. | |
| ticket | Validation Ticket | Yes | sSoIc1T8Jh0wPCQmNzvA | The Service Ticket obtained from authentication login. |
| format | Format Type | No | The format for returning user information. Options are XML and JSON. Default: XML |
# Request Example
GET https://{your_domain}/api/v1/cas/p3/serviceValidate?ticket=SoIc1T8Jh0wPCQmNzvA&service=http://casdemo.bccastle.com/demo/callback
# Response Parameters
If the request is successful, besides the fixed parameter user for the username, custom parameter mappings can be added via Application Management -> Authentication Configuration -> Mapping Configuration. Mapped parameters are returned under attributes. The following parameter calls are described using the example of adding a mobile phone number parameter mobile.
| Parameter Name | Chinese Name | Required | Example Value | Description |
|---|---|---|---|---|
| serviceResponse | Level 1: Response Object | Yes | Object | |
| authenticationSuccess | Level 2: Authentication Success | Yes | Object | |
| attributes | Level 3: Parameters | Yes | Object | |
| isFromNewLogin | Level 4 | Yes | true | Fixed as true |
| authenticationDate | Level 4: Authentication Time | Yes | 2022-03-08T01:34:12.460Z | |
| longTermAuthenticationRequestTokenUsed | Level 4 | Yes | false | Fixed as false |
| mobile | Level 4 | No | +86-17322881122 | Parameter dynamically added through authentication mapping configuration |
| user | Level 3: Username | Yes |
# Return Examples
Correct example returned in JSON format
HTTP Status: 200 OK
format = JSON
{
"serviceResponse": {
"authenticationSuccess": {
"attributes": {
"isFromNewLogin": true,
"authenticationDate": "2022-03-08T01:34:12.460Z",
"longTermAuthenticationRequestTokenUsed": **false,**
"mobile": "+86-17322881122"
},
"user": "admin"
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Correct example returned in XML format
HTTP Status: 200 OK
format = XML
<cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
<cas:authenticationSuccess>
<cas:user>admin</cas:user>
<cas:attributes>
<cas:authenticationDate>2022-03-08T01:34:12.460Z</cas:authenticationDate>
<cas:longTermAuthenticationRequestTokenUsed>false</cas:longTermAuthenticationRequestTokenUsed>
<cas:isFromNewLogin>true</cas:isFromNewLogin>
<cas:mobile>+86-17322881122</cas:mobile>
</cas:attributes>
</cas:authenticationSuccess>
</cas:serviceResponse>
2
3
4
5
6
7
8
9
10
11
12
13
Error example returned in JSON format
HTTP Status: 200 OK
format=JSON
{
"serviceResponse": {
"authenticationFailure": {
"code": "INVALID_TICKET",
"description": "the ticket provided was not valid, ticket is 'jiVKc'"
}
}
}
2
3
4
5
6
7
8
9
10
Error example returned in XML format
HTTP Status: 200 OK
format=XML
<cas:serviceResponse xmlns:cas="http://www.yale.edu/tp/cas">
<cas:authenticationFailure code="INVALID_TICKET">
the ticket provided was not valid, ticket is 'jiVKc'
</cas:authenticationFailure>
</cas:serviceResponse>
2
3
4
5
6
7
