Registering application ( cas overlay template v 6.2)

178 views
Skip to first unread message

Ruhith Udakara

unread,
Nov 26, 2019, 1:18:39 AM11/26/19
to CAS Developer
hi guys,

i'm pretty new to this and i install CAS server and it's now successfully login with default username and password. and i registered a test application as this tutorial.and i created a service folder and json file

this is my cas.properties file

cas.server.prefix=${cas.server.name}/cas

cas.serviceRegistry.initFromJson=true
cas.serviceRegistry.json.location=file:/etc/cas/services

cas.authn.ldap[0].principalAttributeList=sn,cn:commonName,givenName,eduPersonTargettedId:SOME_IDENTIFIER

cas.authn.ldap[0].collectDnAttribute=false
cas.authn.ldap[0].principalDnAttributeName=principalLdapDn
cas.authn.ldap[0].allowMultiplePrincipalAttributeValues=true
cas.authn.ldap[0].allowMissingPrincipalAttributeValue=true
cas.authn.ldap[0].credentialCriteria=

logging.config: file:/etc/cas/config/log4j2.xml

this is my json file inside the service direactory

{
   
"@class" : "org.apereo.cas.services.RegexRegisteredService",
   
"serviceId" : "https://app.example.org",
   
"name" : "ApplicationName",
   
"id" : 1001,
   
"evaluationOrder" : 10
 
}

 

this is my build.gradle file

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        jcenter()
        maven { url "https://repo.spring.io/libs-milestone" }
        maven { url "https://repo.spring.io/libs-snapshot" }
        maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        classpath "de.undercouch:gradle-download-task:${project.gradleDownloadTaskVersion}"
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.springBootVersion}"
        classpath "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:${project.jibVersion}"
        classpath "io.freefair.gradle:maven-plugin:${project.gradleMavenPluginVersion}"
    }
}

repositories {
    mavenLocal()
    mavenCentral()
    jcenter()
    maven { url "https://repo.spring.io/milestone/" }
    maven { url "https://repo.spring.io/snapshot/" }
}

def casServerVersion = project.'cas.version'
def casWebApplicationBinaryName = "cas.war"

project.ext."casServerVersion" = casServerVersion
project.ext."casWebApplicationBinaryName" = casWebApplicationBinaryName

apply plugin: "io.freefair.war-overlay"
apply from: rootProject.file("gradle/tasks.gradle")

apply plugin: "war"
apply plugin: "eclipse"
apply plugin: "idea"

apply from: rootProject.file("gradle/springboot.gradle")
apply from: rootProject.file("gradle/dockerjib.gradle")

dependencies {
    // Other CAS dependencies/modules may be listed here...
    compile "org.apereo.cas:cas-server-support-json-service-registry:${casServerVersion}"
    compile "org.apereo.cas:cas-server-support-ldap:${project.'cas.version'}"
}

tasks.findByName("jibDockerBuild")
    .dependsOn(copyWebAppIntoJib, copyConfigIntoJib)
    .finalizedBy(deleteWebAppFromJib)

tasks.findByName("jib")
    .dependsOn(copyWebAppIntoJib, copyConfigIntoJib)
    .finalizedBy(deleteWebAppFromJib)
    
configurations.all {
    resolutionStrategy {
        cacheChangingModulesFor 0, "seconds"
        cacheDynamicVersionsFor 0, "seconds"

        preferProjectModules()

        def failIfConflict = project.hasProperty("failOnVersionConflict") && Boolean.valueOf(project.getProperty("failOnVersionConflict"))
        if (failIfConflict) {
            failOnVersionConflict()
        }
    }
}

eclipse {
    classpath {
       downloadSources = true
       downloadJavadoc = true
    }
}

idea {
    module {
        downloadJavadoc = true
        downloadSources = true
    }
}

bootWar {
    entryCompression = ZipEntryCompression.STORED
    overlays {
        // Note: The "excludes" property is only for files in the war dependency.
        // If a jar is excluded from the war, it could be brought back into the final war as a dependency
        // of non-war dependencies. Those should be excluded via normal gradle dependency exclusions.
        cas {
            from "org.apereo.cas:cas-server-webapp${project.appServer}:${casServerVersion}@war"
            provided = false
            //excludes = ["WEB-INF/lib/somejar-1.0*"]
        }
    }
}


wrapper {
    distributionType = Wrapper.DistributionType.BIN
    gradleVersion = "${project.gradleVersion}"
}



when i trying to access https://localhost:8443/cas/login?service=https://app.example.org

i'm getting this error

CAS.PNG

what did i missed here?please point me to right direction that would be a big help

Jakub Fridrich

unread,
Nov 26, 2019, 3:30:17 AM11/26/19
to CAS Developer
Hi,
You can try replace line in buildgradle with

compile "org.apereo.cas:cas-server-support-json-service-registry:${project.'cas.version'}"

instead of
compile "org.apereo.cas:cas-server-support-json-service-registry:${casServerVersion}"




Dne úterý 26. listopadu 2019 7:18:39 UTC+1 Ruhith Udakara napsal(a):

Ruhith Udakara

unread,
Nov 26, 2019, 5:00:39 AM11/26/19
to CAS Developer
hi,

thanks for the reply,but that didn't worked.

Julien Gribonvald

unread,
Nov 28, 2019, 9:09:25 AM11/28/19
to cas...@apereo.org

Hi folks,

This message is related to this Pull Request #4426 and #4427 in CAS 6.1.2 and 6.2 version. The PR fix is working only at first login and if all cookies are cleared after, the problem is that the JSESSIONID cookie exist again even if you logout as it's not cleared, and so It tries to retrieve the session/ticket from an older value and it link the transient service ticket to the old value.

I'm guessing if someone know a way to avoid that ? I tried to find a way to force the cookie value change but i's not really applied everywhere (as it doesn't applied before a page is viewed), or I didn't find where to do it. If someone have an idea feel free to purpose it !

On an other side I'm guessing if it's a good way to do ? I think it would be better to avoid to use a cookie as in this case the session could be retrieved on an other way. As example with SAML AuthnRequest an ID is generated and the IDP in his response provide it (attribute inResponseTo). So why not using this attribute and let to tomcat the JSESSIONID cookie ? It's an idea only. After I'm not sure if this will work in an UNSOLICITED request (I can't test it).

Any overview would be appreciated !

Thanks

Julien


Reply all
Reply to author
Forward
0 new messages