Hi,
I have CAS server set up successfully and SSO login works without any issues. Now, I want to using a Java client to do single sign-on using the RESTful API and I am running into issues. Can you please help?
The documentation seems straight-forward but I can't seem to get it to work. This is my configuration in CAS server -
<servlet>
<servlet-name>restlet</servlet-name>
<servlet-class>com.noelios.restlet.ext.spring.RestletFrameworkServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>restlet</servlet-name>
<url-pattern>/v1/*</url-pattern>
</servlet-mapping>
In pom.xml, I have this
<dependency>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-server-integration-restlet</artifactId>
<version>3.3.3</version>
<type>jar</type>
</dependency>
I have cas server version 3.3.3. I use Apache Http client to do the posting like this -
String data = "username="+URLEncoder.encode(username) + "&password=" + URLEncoder.encode(password);
HttpClient client = new HttpClient();
PostMethod post = new PostMethod(casServerUrl);
post.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
post.setRequestBody(data);
int tgtStatus = client.executeMethod(post);
String response = post.getResponseBodyAsString();
I am getting a http 302 status and an empty response back. I also tried constructing a http post using java URLConnection and I get the login page back as part of the response.
In CAS client, I am posting to url -
https://casserver:8443/cas/v1/tickets
am I doing something wrong?
thanks,
Ramya
--
You are currently subscribed to [hidden email] as: [hidden email]
To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user