1

Wicket プロジェクトの 1 つに問題があります。私が使用する 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 呼び出しはまったくありません)。

誰かがすでにこの種の問題に遭遇していますか?

4

1 に答える 1

1

私はちょうど同じ問題を経験しました。それを機能させるために、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);
}

AuthenticatedWebSessionのサインインとリダイレクトを処理するIRequestMapperを作成します。

@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).
于 2013-01-30T19:41:54.153 に答える