簡體   English   中英

wicket-auth-roles和spring-security-cas-client之間的身份驗證集成問題

[英]Authentication integration issue between wicket-auth-roles and spring-security-cas-client

我的一個Wicket項目有一個問題。 我使用的wicket版本是1.5.7版本,帶有wicket-auth-roles(相同版本)。

我正在嘗試與CAS服務器集成。 為此,我正在嘗試使用spring-security-cas-client(3.0.7.RELEASE),但是CAS身份驗證根本不起作用。 在這個項目中,我已經在使用spring-security-core(3.1.0.RELEASE),spring-security-config和spring-security-ldap,並且工作正常。

我遇到的問題是第一次訪問Wicket頁面時。 通常我必須接受CAS審訊; 但是盡管如此,我的自定義authenticatedWebApplication的方法“ getSignInPageClass”(wicket-auth-roles)被調用,並且我自動轉發到登錄頁面(根本沒有得到任何CAS調用)。

有人已經遇到過這類問題嗎?

我只是遇到了同樣的問題。 為了使其正常工作,我讓Wicket重定向到CAS,然后CasAuthenticationFilter驗證令牌並處理身份驗證。 我不知道這是否是最好的解決方案,但我使用RequestMapper來處理AuthenticatedWebSession登錄。

Spring安全配置

<!-- https://cwiki.apache.org/WICKET/spring-security-and-wicket-auth-roles.html -->
<http use-expressions="true" auto-config="true" entry-point-ref="casEntryPoint">
    <intercept-url pattern="/**" />

    <custom-filter ref="casFilter" position="CAS_FILTER"/>
</http>

覆蓋AuthenticatedApplication中的restartResponseAtSignInPage

/**
 * Stores original Url and redirects to CAS login for authentication. CAS will redirect back to this
 * service using the service parameter. 
 */
@Override
public void restartResponseAtSignInPage() {
    Session.get().setAttribute("originalUrl", RequestCycle.get().getRequest().getOriginalUrl());
    // This will be the URL back to the Spring CAS filter
    String service = "service=https%3A%2F%2F" + casServiceHost + "%2Fapp%2Flogin";
    throw new RedirectToUrlException("https://" + casServerHost + "/cas/login?" + service);
}

創建一個IRequestMapper來處理AuthenticatedWebSession登錄和重定向。

@Override
public IRequestHandler mapRequest(Request request) {
    logger.info("CasAuthMapper mapping {}", request.getUrl());
    // The authentication will have been handled by Spring's CasAuthenticationFilter
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
    // ... Do whatever you need to do here. I added a simple method to my web session to delegate to signIn(boolean).

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM