Hi!
I'm new to pac4j and having some trouble about proxy ticket.
I have 2 application, the first one is the Web Client and the other is the Web Service. User should login from the Web Client and not from the Web Service directly. So the Web Client need to calling CAS to get a proxy ticket for my Web Service.
I already define the new callback url for proxy and declare the CasProxyReceptor.
Here is my Global setup.
final String baseUrl = Play.application().configuration().getString("baseUrl");
final String casUrl = Play.application().configuration().getString("casUrl");
final CasClient casClient = new CasClient();
casClient.setCasLoginUrl(casUrl);
casClient.setCasProtocol(CasClient.CasProtocol.CAS20_PROXY);
casClient.setAcceptAnyProxy(true);
final CasProxyReceptor casProxyReceptor = new CasProxyReceptor();
casClient.setCasProxyReceptor(casProxyReceptor);
final Clients clients = new Clients(baseUrl + "/casProxyCallback", casClient, casProxyReceptor);
Config.setClients(clients);
Here is my route file.
GET /callback org.pac4j.play.CallbackController.callback()
POST /callback org.pac4j.play.CallbackController.callback()
GET /casProxyCallback org.pac4j.play.CallbackController.callback()
POST /casProxyCallback org.pac4j.play.CallbackController.callback()
And here is my controller.
@RequiresAuthentication(clientName = "CasClient")
public static Result index() {
final CommonProfile profile = getUserProfile();
String proxyTicket = null;
if (profile instanceof CasProxyProfile) {
final CasProxyProfile proxyProfile = (CasProxyProfile) profile;
proxyTicket = proxyProfile.getProxyTicketFor(service);
Logger.debug(proxyTicket);
}
String proxyResponse = service+"?ticket=" + proxyTicket;
WSRequestHolder holder = WS.url(proxyResponse);
Promise<WSResponse> responsePromise = holder.get();
return ok(views.html.index.render("Your new application is ready.",proxyResponse));
}
I can get the proxyTicket, but i've got an error that said i'm missing the proxy granting ticket.
[error] o.p.c.c.CasProxyReceptor - Missing proxyGrantingTicket or proxyGrantingTicketIou
What should i do about that error? Do I still missing some configuration here?
Thank in advance for any help!
Regards,
Lynn