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