0

I want to learn and build cas(central authentication system) using maven. and followed this tutorial: https://wiki.jasig.org/display/CASUM/Best+Practice+-+Setting+Up+CAS+Locally+using+the+Maven+WAR+Overlay+Method to get a cas.war. This war works fine, I can successfully jump to CAS login page via:https://localhost:8443/cas/login

Then I want to try CAS java client using CAS RESTFul API.Following this wonderful tutorial: Working Java REST Client Example to access CAS REST API

The first step in this tutorial is to add a restful dependency in cas's pom.xml, so I need to recompile pom.xml using maven, adding the dependency I need, the pom.xml is now as follows:

<?xml version="1.0" encoding="UTF-8"?>

http://maven.apache.org/xsd/maven-4.0.0.xsd "> 4.0.0 edu.university.cas local-cas war 1.0-SNAPSHOT

<build>
    <plugins>
        <plugin>
             <artifactId>maven-war-plugin</artifactId>
                         <configuration>
                             <warName>cas</warName>
                         </configuration>
                    </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.jasig.cas</groupId>
        <artifactId>cas-server-webapp</artifactId>
        <version>${cas.version}</version>
        <type>war</type>
        <scope>runtime</scope>
    </dependency>

<dependency>
    <groupId>org.jasig.cas</groupId>
    <artifactId>cas-server-integration-restlet</artifactId>
    <version>${cas.version}</version>
    <type>jar</type>
</dependency>
</dependencies>

<properties>
    <cas.version>3.5.2</cas.version>
</properties>

    <repositories>
         <repository>
              <id>ja-sig</id>
              <url>http://oss.sonatype.org/content/repositories/releases/ </url>
         </repository>
    </repositories>

However, this time when I use the war I get, I can't jump to login page, the page stucks, nothing pops out.

I wonder what I've done wrong here. Or where can I get pom.xml for cas server including restful dependecy?

Community
  • 1
  • 1
Demonedge
  • 1,363
  • 4
  • 18
  • 33

1 Answers1

0

Disclaimer: I'm the Chairman of CAS and founder of CAS in the cloud (https://www.casinthecloud.com).

The official REST doc for 3.5.x is: https://wiki.jasig.org/display/casum/restful+api
and the one for 4.0 is: http://jasig.github.io/cas/4.0.x/protocol/REST-Protocol.html.
And: http://jasig.github.io/cas/4.0.x/installation/Maven-Overlay-Installation.html.

It should be straightforward: you need a new Maven dependency and to add a servlet in the web.xml file.

(edit dead links)

flow
  • 4,828
  • 6
  • 26
  • 41
jleleu
  • 2,309
  • 1
  • 13
  • 9
  • Thank you.I downloaded https://github.com/UniconLabs/simple-cas4-overlay-template, execute mvn clean package and copy the cas.war I get to tomcat's webapp file, but I can't jump to cas login page by https://localhost:8443/cas/login, my browser gives me a 404. – Demonedge Nov 19 '14 at 07:30
  • Are you sure that your context path is not /simple-cas4-overlay-template? (in the server.xml file in Tomcat) – jleleu Nov 19 '14 at 12:52
  • I guess I still don't know details about how to use RESTful API. Is there any document can teach me build a java client from scratch? I want to use CAS on an Android Client. And does CAS has a register module?Thank you! – Demonedge Nov 20 '14 at 06:30
  • Not really, you should take a look at the CAS flow and other Android implementations – jleleu Nov 20 '14 at 12:54
  • I tried this: https://github.com/UniconLabs/simple-cas4-overlay-template but I don't know how to configurate directory if I don't want to put cas.properties and log4j.xml in /etc/cas, do you have any ideas? thanks! – Demonedge Nov 21 '14 at 08:20
  • You should the location here: https://github.com/UniconLabs/simple-cas4-overlay-template/blob/master/src/main/webapp/WEB-INF/spring-configuration/propertyFileConfigurer.xml#L9 – jleleu Nov 21 '14 at 12:21
  • I changed this to where I put cas.properties, but tomcat still give this error: java.io.FileNotFoundException: Log4j config file [/etc/cas/log4j.xml] not found in its log file,where should I change to tell tomcat the location of log4j.xml? – Demonedge Nov 24 '14 at 01:26
  • http://jasig.github.io/cas/4.0.x/protocol/REST-Protocol.html link is broken – Julien Palard May 03 '18 at 09:41