Validate Ticket
The application validates the ticket and obtains user attribute information.
Request Description
http
GET https://{your_domain}/api/v1/cas/p3/serviceValidateRequest Parameters
| Parameter Name | Chinese Name | Required | Example Value | Description |
|---|---|---|---|---|
| service | Callback Address | Yes | The address where the application accepts the ticket, which must be consistent with the application Service address configured in the application CAS configuration. | |
| ticket | Validation Ticket | Yes | sSoIc1T8Jh0wPCQmNzvA | Ticket, Service Ticket obtained from authentication login. |
| format | Format Type | No | Format of the user information response. XML and JSON are optional. Default: XML |
Request Example
GET https://{your_domain}/api/v1/cas/p3/serviceValidate?ticket=SoIc1T8Jh0wPCQmNzvA&service=http://casdemo.bccastle.com/demo/callbackResponse Parameters
If returned successfully, in addition to the fixed parameter user being the username, custom parameter mappings can be added through Application Management > Authentication Configuration > Mapping Configuration. The mapped parameters are returned under attributes as described below, using the added mobile phone number mobile parameter as an example.
| 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 | Parameters dynamically added through authentication mapping configuration |
| user | Level 3: Username | Yes |
Response Examples
Correct response example in JSON format
json
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"
}
}
}Correct response example in XML format
xml
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>Error response example in JSON format
json
HTTP Status: 200 OK
format=JSON
{
"serviceResponse": {
"authenticationFailure": {
"code": "INVALID_TICKET",
"description": "the ticket provided was not valid, ticket is 'jiVKc'"
}
}
}Error response example in XML format
xml
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>