“验证”方法响应中的 ProxyGrantingTicket - Pac4J 支持

问题描述 投票:0回答:1

我有一个用例,我需要直接在

/p3/serviceValidate
响应中获取代理授予票证。请参阅此处 -> Apereo 文档 我的回应示例:

<cas:serviceResponse
    xmlns:cas='http://www.yale.edu/tp/cas'>
    <cas:authenticationSuccess>
        <cas:user>jleleu</cas:user>
        <cas:attributes>
            <cas:credentialType>UsernamePasswordCredential</cas:credentialType>
            <cas:clientIpAddress>192.168.0.15</cas:clientIpAddress>
            <cas:isFromNewLogin>true</cas:isFromNewLogin>
            <cas:authenticationDate>2024-02-28T10:54:06.574818300Z</cas:authenticationDate>
            <cas:authenticationMethod>Static Credentials</cas:authenticationMethod>
            <cas:geoLocation>unknown</cas:geoLocation>
            <cas:successfulAuthenticationHandlers>Static Credentials</cas:successfulAuthenticationHandlers>
            <cas:proxyGrantingTicket>dHSWhcO9Ks35tg10...RestOfEncodedPGT</cas:proxyGrantingTicket>
            <cas:serverIpAddress>192.168.0.175</cas:serverIpAddress>
            <cas:userAgent>PostmanRuntime/7.36.3</cas:userAgent>
            <cas:longTermAuthenticationRequestTokenUsed>false</cas:longTermAuthenticationRequestTokenUsed>
        </cas:attributes>
    </cas:authenticationSuccess>
</cas:serviceResponse>

这与我们处理 pgtCallback url 定义的回调并使用 pgtIou 的默认方法有所不同。这里根本不会使用pgtIou。

最终目标是在我的 JEE 应用程序中请求代理票证并调用由同一 CAS 服务器保护的 RestAPI。

我正在考虑使用

DirectRestClient
来验证服务,但它使用不同的 API 方法。 Pac4J 库中有可用的东西来处理这种情况吗?或者我应该自己构建一些自定义的东西?

cas pac4j
1个回答
0
投票

要获取代理票,您需要调用

getProxyTicketFor
CasProxyProfile
方法。这个
CasProxyProfile
在常规代理流 (pgtIou) 中返回。在您的情况下,您应该覆盖
CasProfileDefinition
CasAuthenticator
的默认
CasClient
以从响应中读取加密的 pgt。

© www.soinside.com 2019 - 2024. All rights reserved.