Search code examples
restmavenauthenticationcas

CAS Apereo REST API - Authentication has failed


I try to configure the Apereo CAS 5.0.6 REST API and I have and when I send a POST request to get a TGT, I got this error :

WARN [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - 
<Authentication has failed. Credentials may be incorrect or CAS cannot find authentication
handler that supports [username] of type [UsernamePasswordCredential], which suggests a configuration problem.>

I have tried this with RESTED on Firefox :

  • URL : https://cas.services/cas/v1/tickets
  • Method : POST
  • Headers : Content-Type application/x-www-form-urlencoded
  • Request body : URLEncoded form data (with username and password form fields)

And I have 401 too.

I use the Docker image apereo/cas:v5.0.6.

My pom.xml :

<dependency>
    <groupId>org.apereo.cas</groupId>
    <artifactId>cas-server-webapp</artifactId>
    <version>${cas.version}</version>
    <type>war</type>
    <scope>runtime</scope>
</dependency>
<dependency>
    <groupId>org.apereo.cas</groupId>
    <artifactId>cas-server-support-spnego-webflow</artifactId>
    <version>${cas.version}</version>
</dependency>
<dependency>
    <groupId>org.apereo.cas</groupId>
    <artifactId>cas-server-support-rest</artifactId>
    <version>${cas.version}</version>
    <scope>runtime</scope>
</dependency>
<dependency>
    <groupId>org.samba.jcifs</groupId>
    <artifactId>jcifs-ext</artifactId>
    <version>0.9.4</version>
    <scope>runtime</scope>
</dependency>

The authentication works when I go to https://cas.services/cas/ with Firefox


Solution

  • it was missing cas.authn.ldap configuration in cas.propeties...