Hello is it possible to run a Jersey client 1.18.1 against Cas 4.0 to
obtain a TGT?

My client is:

private String getTicketGrantingTicket(String username, String password)
throws IOException {
MultivaluedMap<String, String> params = new MultivaluedMapImpl();
params.add("username", username);
params.add("password", password);
Client client = Client.create();
WebResource webResource = client.resource(casUrl);
ClientResponse response = webResource.post(ClientResponse.class, params);
if (response.getStatus() == Response.Status.BAD_REQUEST.getStatusCode()) {
throw new AuthenticationException("not possible");
}
ClientResponse.Status status =
ClientResponse.Status.fromStatusCode(response.getStatus());
if (status.getFamily() !=
javax.ws.rs.core.Response.Status.Family.SUCCESSFUL) {
throw new AuthenticationException("Not able to get CAS ticket ");
}
List<String> locationHeaders = response.getHeaders().get("Location");
String locationHeader = null;
if (locationHeaders.size() > 0) {
locationHeader = locationHeaders.get(0);
}
return locationHeader;
}

Running this returns 500 Internal server error on client side.

cas log:
2015-05-21 14:51:56,537 DEBUG
[org.jasig.cas.integration.restlet.TicketResource] - Obtaining
credentials...

Regards

-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to