Skip to content

验证票据

应用验证票据,并获取用户属性信息。

请求说明

http
GET https://{your_domain}/api/v1/cas/p3/serviceValidate

请求参数

参数名中文名称必填示例值描述
service回调地址应用接受票据的地址,必须与应用CAS配置中的应用Service地址一致。
ticket验证票据sSoIc1T8Jh0wPCQmNzvA票据,认证登录获取的Service Ticket
format格式类型响应用户信息的格式,可选择XML和JSON。 缺省值:XML

请求示例

GET https://{your_domain}/api/v1/cas/p3/serviceValidate?ticket=SoIc1T8Jh0wPCQmNzvA&service=http://casdemo.bccastle.com/demo/callback

返回参数

如果成功返回,除了固定参数user为用户名,可通过应用管理-认证配置-映射配置,添加自定义参数映射。映射参数在attributes下返回以下参数调用,都以添加手机号mobile参数为例进行描述。

参数名中文名称必填示例值描述
serviceResponse一层:响应对象Object
authenticationSuccess二层:认证成功Object
attributes三层:参数Object
isFromNewLogin四层true固定为true
authenticationDate四层:认证时间2022-03-08T01:34:12.460Z
longTermAuthenticationRequestTokenUsed四层false固定为false
mobile四层+86-17322881122通过认证映射配置动态添加的参数
user三层:用户名

返回示例

以json格式返回正确示例

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"
        }
    }
}

以XML格式返回正确示例

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>

以JSON格式返回错误示例

json
HTTP Status: 200 OK
format=JSON
{
    "serviceResponse": {
        "authenticationFailure": {
            "code""INVALID_TICKET",
            "description""the ticket provided was not valid, ticket is &#39;jiVKc&#39"
        }
    }
}

以XML格式返回错误示例

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 &#39;jiVKc&#39;  
    </cas:authenticationFailure>
</cas:serviceResponse>

竹云IDaaS开放平台