Hi CAS  users and experts, (this is a beginners question),

i try to use Cas Java Client 2.1.1 and try to validate a given ticket in a
Java App. (should be a Test for  JavaWebStart Apps)
I constructed a very simple dumb example, where the just received valid
ticket should again
be validated by ServiceTicketValidator.validate(); in a servlet, but it
allways returns INVALID_TICKET ticket 'ST-...' not recognized.
 
 Where is my mistake please.
 
Later on i'd like to pass the ticket as argument to a WebStart App and let
the app call ServiceTicketValidator.validate().
 
 
best regards 
Markus
 

########################################
My example servlet receives a valid ticket (this is the log from CAS)
########################################

2007-01-17 15:58:05,562 INFO
[org.jasig.cas.authentication.AuthenticationManagerImpl] -
<AuthenticationHandler:
org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthe
nticationHandler successfully authenticated the user which provided the
following credentials: ee>

2007-01-17 15:58:05,562 INFO
[org.jasig.cas.CentralAuthenticationServiceImpl] - <Granted service ticket
[ST-7-7yrg1yX9M6KSgGqQLwXlgZVGee4SXZ2EFox-20] for service
[https://vwplan.wob.vw.vwg:8093/VISystem/vwplan_visystem_pruefgelaende_index
.jsp] for user [ee]>

########################################
This is the servlet code:
########################################
<html>
<head>
<p> ##### CAS Filter is set up in web.xml ####</p>
<p> ##### This Servlet itself is the serviceURL
("https://vwplan.wob.vw.vwg:8093/VISystem/vwplan_visystem_pruefgelaende_inde
x.jsp")
                     which is called after successful CAS Login Page
####</p>
</head>

<body>
<%
out.println("cas
user="+session.getAttribute("edu.yale.its.tp.cas.client.filter.user"));
out.println("<br><br>");
out.println("cas
receipt="+session.getAttribute("edu.yale.its.tp.cas.client.filter.receipt"))
;
out.println("<br><br>");
String ticket = request.getParameter("ticket");
out.println("cas ticket=#"+ticket+"#");
out.println("<br><br>");
if(ticket!=null) {
try {
edu.yale.its.tp.cas.client.ServiceTicketValidator sv = new
edu.yale.its.tp.cas.client.ServiceTicketValidator();
sv.setCasValidateUrl("https://vwplan.wob.vw.vwg:8093/cas/serviceValidate";);
sv.setService("https://vwplan.wob.vw.vwg:8093/VISystem/vwplan_visystem_pruef
gelaende_index.jsp");
sv.setServiceTicket(ticket);
sv.validate();
out.println("My JSP... sv.validate()");
String xmlResponse = sv.getResponse();
if(sv.isAuthenticationSuccesful()) {
String user = sv.getUser();
out.println("... sv.isAuthenticationSuccesful() user ="+user);
} else {
throw new Exception(sv.getErrorCode()+" "+sv.getErrorMessage());
}
} catch (Exception exc) {

out.println(exc.getMessage());
}
}
%>
</body>
</html>

########################################
This is the output the servlet generates, where
ServiceTicketValidator.validate() allways returns INVALID_TICKET ticket
'ST-7-...'  not recognized
########################################

cas user=ee

cas receipt=[edu.yale.its.tp.cas.client.CASReceipt userName=[ee]
casValidateUrl=[https://vwplan.wob.vw.vwg:8093/cas/serviceValidate]
proxyCallbackUrl=[null] pgtIou=[null]
casValidateUrl=[https://vwplan.wob.vw.vwg:8093/cas/serviceValidate]
proxyList=[[]]]

cas ticket=#ST-7-7yrg1yX9M6KSgGqQLwXlgZVGee4SXZ2EFox-20#

My JSP... sv.validate() INVALID_TICKET ticket
'ST-7-7yrg1yX9M6KSgGqQLwXlgZVGee4SXZ2EFox-20' not recognized



_______________________________________________
Yale CAS mailing list
[email protected]
http://tp.its.yale.edu/mailman/listinfo/cas

Reply via email to