私の CAS 環境には、CAS サーバーと 2 つの (Grails) Web アプリケーション (API および UI) が含まれています。
CAS サーバー: (CAS + RESTful API が有効な Spring Security)
https://server/cas/login
サービス 1: (プロキシ経由で app-api と通信するメイン ユーザー UI)
https://server/app/j_spring_cas_security_check
サービス 2:
https://server/app-api/j_spring_cas_security_check
「アプリ」は、次のようにプロキシ チケットを照会することで「app-api」と通信します ...
String getProxyTicketFor( String serviceUrl ) {
String ticket = null;
try {
def context = SecurityContextHolder.getContext();
def auth = context?.getAuthentication();
def assertion = auth?.getAssertion();
def principal = assertion?.getPrincipal();
ticket = principal?.getProxyTicketFor( serviceUrl );
} catch(e) { ... }
return ticket;
}
これはすべて私の前にセットアップされており、意図したとおりに機能します。
これとは別に、カスタム ポートを介して JBoss で実行されているバックエンド サーバーと通信する「レガシー」Java Web Start (Jnlp) アプリもあります。
私のタスクと問題は次のとおりです。Jnlpランチャーを介して渡されたサービスチケットを介して、認証されたcasユーザーに代わって、このJWSサーバーがcasified webapp(サービス1)と通信できるようにしたいと考えています。ユーザーは、「アプリ」UI を介して JNLP を起動できます。これにより、Java Web Start クライアントとそのサーバーとの間の対話が可能になります。資格情報を再入力することなく、JWS サーバーがユーザーに代わってサービス 1 と通信できるようにしたいと考えています。
独自の Service1 URL を使用して「アプリ」からサービス チケットを要求し、ST-66-IlSRiXhm54ooRFeUXOZO-cas などの適切なサービス チケットを取得しています。
私がやろうとしていることの基本的な要点は、最初にCurlを使用してRESTful APIをヒットしてサービスチケットを生成し、次に別のCurlセッションを使用してチケットを使用することをテストするとうまくいくようです.
// 1. Request TGT - Response TGT TICKET: [TGT-18-CZfUKZMjQWfwTE4fkUOqihhoNVRhpLg2KNcxxtYZd2QJHRmdLN-cas]
$ curl -k -s -c cookie1.txt -b cookie1.txt -d username=user1&password=password https://server/cas/v1/tickets
// 2. Request ST using TGT - Response ST TICKET: ST-18-1WqgeEsRBSLQ92GeOwXx-cas
$ curl -k -s -c cookie1.txt -b cookie1.txt -d service=https://server/app/j_spring_cas_security_check https://server/cas/v1/tickets/TGT-18-CZfUKZMjQWfwTE4fkUOqihhoNVRhpLg2KNcxxtYZd2QJHRmdLN-cas
// 3. Use ST Ticket to "validate" connection against the Spring Security service ticket consumption page
$ curl -k -s -c cookie2.txt -b cookie2.txt -d ticket=ST-18-1WqgeEsRBSLQ92GeOwXx-cas https://server/app/j_spring_cas_security_check -o output1.txt -L
// 4. I am now able to reach my protected document
$ curl -k -s -c cookie2.txt -b cookie2.txt https://server/app/document.txt -o output2.txt -L
以前に「アプリ」から要求したサービス チケットをテストして、JNLP で使用するために、基本的に、受け取った ST を使用して、上記の手順 3 と 4 を手動で実行しました。手順 3 で失敗します。使用しようとすると、 AUTHENTICATION_SUCCESS の直後に PROXY_GRANTING_TICKET_NOT_CREATED が続きます。
エラーメッセージ
=============================================================
WHO: [callbackUrl: https://server/app/casCommunicator/proxyCallback]
WHAT: supplied credentials: [callbackUrl: https://server/app/casCommunicator/proxyCallback]
ACTION: AUTHENTICATION_SUCCESS
APPLICATION: CAS
WHEN: Wed Sep 19 17:23:37 EDT 2012
CLIENT IP ADDRESS: 127.0.0.1
SERVER IP ADDRESS: 127.0.0.1
=============================================================
2012-09-19 17:23:37,058 DEBUG [org.jasig.cas.ticket.registry.DefaultTicketRegistry] - Attempting to retrieve ticket [ST-32-ffeocQpdbYwtblIydlOm-cas]
2012-09-19 17:23:37,058 DEBUG [org.jasig.cas.ticket.registry.DefaultTicketRegistry] - Ticket [ST-32-ffeocQpdbYwtblIydlOm-cas] found in registry.
2012-09-19 17:23:37,058 DEBUG [org.jasig.cas.ticket.registry.DefaultTicketRegistry] - Attempting to retrieve ticket [ST-32-ffeocQpdbYwtblIydlOm-cas]
2012-09-19 17:23:37,058 DEBUG [org.jasig.cas.ticket.registry.DefaultTicketRegistry] - Ticket [ST-32-ffeocQpdbYwtblIydlOm-cas] found in registry.
2012-09-19 17:23:37,058 INFO [com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - Audit trail record BEGIN
=============================================================
WHO: https://server/app/casCommunicator/proxyCallback
WHAT: org.jasig.cas.ticket.InvalidTicketException
ACTION: PROXY_GRANTING_TICKET_NOT_CREATED
APPLICATION: CAS
WHEN: Wed Sep 19 17:23:37 EDT 2012
CLIENT IP ADDRESS: 127.0.0.1
SERVER IP ADDRESS: 127.0.0.1
=============================================================
2012-09-19 17:23:37,058 ERROR [org.jasig.cas.web.ServiceValidateController] - TicketException generating ticket for: [callbackUrl: https://server/app/casCommunicator/proxyCallback]
org.jasig.cas.ticket.InvalidTicketException
at org.jasig.cas.CentralAuthenticationServiceImpl.delegateTicketGrantingTicket_aroundBody6(CentralAuthenticationServiceImpl.java:278)
at org.jasig.cas.CentralAuthenticationServiceImpl.delegateTicketGrantingTicket_aroundBody7$advice(CentralAuthenticationServiceImpl.java:44)
at org.jasig.cas.CentralAuthenticationServiceImpl.delegateTicketGrantingTicket(CentralAuthenticationServiceImpl.java:1)
at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
at org.perf4j.aop.AbstractTimingAspect$1.proceed(AbstractTimingAspect.java:47)
at org.perf4j.aop.AgnosticTimingAspect.runProfiledMethod(AgnosticTimingAspect.java:53)
at org.perf4j.aop.AbstractTimingAspect.doPerfLogging(AbstractTimingAspect.java:45)
at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
at com.github.inspektr.audit.AuditTrailManagementAspect.handleAuditTrail(AuditTrailManagementAspect.java:126)
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy20.delegateTicketGrantingTicket(Unknown Source)
at org.jasig.cas.web.ServiceValidateController.handleRequestInternal(ServiceValidateController.java:125)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody2(SafeDispatcherServlet.java:115)
at org.jasig.cas.web.init.SafeDispatcherServlet.service_aroundBody3$advice(SafeDispatcherServlet.java:44)
at org.jasig.cas.web.init.SafeDispatcherServlet.service(SafeDispatcherServlet.java:1)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.github.inspektr.common.web.ClientInfoThreadLocalFilter.doFilter(ClientInfoThreadLocalFilter.java:63)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
2012-09-19 17:23:37,063 DEBUG [org.jasig.cas.ticket.registry.DefaultTicketRegistry] - Attempting to retrieve ticket [ST-32-ffeocQpdbYwtblIydlOm-cas]
2012-09-19 17:23:37,063 DEBUG [org.jasig.cas.ticket.registry.DefaultTicketRegistry] - Ticket [ST-32-ffeocQpdbYwtblIydlOm-cas] found in registry.
2012-09-19 17:23:37,064 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - ServiceTicket [ST-32-ffeocQpdbYwtblIydlOm-cas] has expired.
2012-09-19 17:23:37,064 DEBUG [org.jasig.cas.ticket.registry.DefaultTicketRegistry] - Removing ticket [ST-32-ffeocQpdbYwtblIydlOm-cas] from registry
2012-09-19 17:23:37,064 DEBUG [org.jasig.cas.ticket.registry.DefaultTicketRegistry] - Attempting to retrieve ticket [ST-32-ffeocQpdbYwtblIydlOm-cas]
2012-09-19 17:23:37,064 INFO [com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - Audit trail record BEGIN
=============================================================
WHO: audit:unknown
WHAT: ST-32-ffeocQpdbYwtblIydlOm-cas
ACTION: SERVICE_TICKET_VALIDATE_FAILED
APPLICATION: CAS
WHEN: Wed Sep 19 17:23:37 EDT 2012
CLIENT IP ADDRESS: 127.0.0.1
SERVER IP ADDRESS: 127.0.0.1
=============================================================
私がやろうとしていることは可能ですか?もしそうなら、私の実装に何か問題があると思いますか?