pac4j error in cas management webapp

51 views
Skip to first unread message

Frédéric Lohier

unread,
Nov 13, 2020, 9:58:23 AM11/13/20
to CAS Community

Hello,

I am trying to setup the CAS Management webapp 6.2.2 with CAS Server 6.2.5. but I am running into the following issue : 

When I log in the CAS Management webapp with a user that exists in the users.json file of the Management webapp, the authentication with CAS is successfull but I get the message "Management app is not available" in the GUI and in the cas-management.log file, I get the error: 

ERROR [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/cas-management].[dispatcherServlet]] - <Servlet.service() for servlet [dispatcherServlet] in context with path [/cas-management] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: 'org.pac4j.core.profile.InternalAttributeHandler org.pac4j.core.profile.ProfileHelper.getInternalAttributeHandler()'] with root cause>

java.lang.NoSuchMethodError: 'org.pac4j.core.profile.InternalAttributeHandler org.pac4j.core.profile.ProfileHelper.getInternalAttributeHandler()'

Any idea where this issue could come from?

From my understanding, pac4j is the component evaluating the identity's attributes coming from CAS server.

With CAS Management in debug log-level, I can see all attributes of the authenticated identity coming from CAS server in the cas-management.log.

Could it be a dependency issue? I build CAS Management with the following gradle properties : 

# Versions
casmgmt.version=6.2.2
cas.version=6.2.5
springBootVersion=2.2.8.RELEASE
appServer=-tomcat
sourceCompatibility=11
targetCompatibility=11
gradleMavenPluginVersion=5.1.1

Jérôme LELEU

unread,
Nov 13, 2020, 10:03:51 AM11/13/20
to CAS Community
Hi,

Indeed, pac4j is the security framework used for authentication.

It feels like a dependency issue as the InternalAttributeHandler component has been removed in pac4j v4.1.0.

What are the versions of the pac4j dependencies?

Thanks.
Best regards,
Jérôme



--
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/0498530b-b40a-4e14-9267-58c31a7148cen%40apereo.org.

Frédéric Lohier

unread,
Nov 13, 2020, 10:18:00 AM11/13/20
to CAS Community, leleuj

Hello,


Thank you for looking into this. The full error stack below is indeed mentionning pac4j 4.1.0 (pac4j-core-4.1.0.jar!/:?]) :

ERROR [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/cas-management].[dispatcherServlet]] - <Servlet.service() for servlet [dispatcherServlet] in context with path [/cas-management] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: 'org.pac4j.core.profile.InternalAttributeHandler org.pac4j.core.profile.ProfileHelper.getInternalAttributeHandler()'] with root cause>

java.lang.NoSuchMethodError: 'org.pac4j.core.profile.InternalAttributeHandler org.pac4j.core.profile.ProfileHelper.getInternalAttributeHandler()'

        at org.pac4j.cas.credentials.authenticator.CasAuthenticator.validate(CasAuthenticator.java:82) ~[pac4j-cas-4.0.3.jar!/:?]

        at org.pac4j.cas.client.direct.DirectCasClient.retrieveCredentials(DirectCasClient.java:91) ~[pac4j-cas-4.0.3.jar!/:?]

        at org.pac4j.core.client.DirectClient.getCredentials(DirectClient.java:42) ~[pac4j-core-4.1.0.jar!/:?]

        at org.pac4j.core.engine.DefaultSecurityLogic.perform(DefaultSecurityLogic.java:119) ~[pac4j-core-4.1.0.jar!/:?]

        at org.pac4j.springframework.web.SecurityInterceptor.preHandle(SecurityInterceptor.java:120) ~[spring-webmvc-pac4j-4.0.1.jar!/:?]

        at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:141) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]

        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1035) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]

        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]

        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]

        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:645) ~[javax.servlet-api-4.0.1.jar!/:4.0.1]

        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:750) ~[javax.servlet-api-4.0.1.jar!/:4.0.1]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-catalina-9.0.37.jar!/:9.0.37]

       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apereo.inspektr.common.web.ClientInfoThreadLocalFilter.doFilter(ClientInfoThreadLocalFilter.java:66) ~[inspektr-common-1.8.10.GA.jar!/:1.8.10.GA]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]

        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]

        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]

        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690) [tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:747) [tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-catalina-9.0.37.jar!/:9.0.37]

        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) [tomcat-coyote-9.0.37.jar!/:9.0.37]

        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-coyote-9.0.37.jar!/:9.0.37]

        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-coyote-9.0.37.jar!/:9.0.37]

        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589) [tomcat-coyote-9.0.37.jar!/:9.0.37]

        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote-9.0.37.jar!/:9.0.37]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]

        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.37.jar!/:9.0.37]

        at java.lang.Thread.run(Thread.java:834) [?:?]

Jérôme LELEU

unread,
Nov 13, 2020, 10:26:53 AM11/13/20
to Frédéric Lohier, CAS Community
Hi,

What's the version of your pac4j-cas dependency? You need pac4j-cas v4.1.0 (to be aligned with pac4j-core v4.1.0)...
Thanks.
Best regards,
Jérôme
 

Frédéric Lohier

unread,
Nov 13, 2020, 10:39:20 AM11/13/20
to Jérôme LELEU, CAS Community
I built the cas management web app from the cas-management-overlay project which does not mention any pac4j dependency.

But the Gradle.properties of the cas management project mentions a pac4j 4.0.3 dependency : 

Frédéric Lohier

unread,
Nov 13, 2020, 10:45:54 AM11/13/20
to Jérôme LELEU, CAS Community
I just noticed that the pac4j dependency has been upgraded to 4.1.0 in the cas management 6.2.3 tag : https://github.com/apereo/cas-management/blob/v6.2.3/gradle.properties

But the building in the overlay project in 6.2.3 fails because of an http error 409 of a cas artifact.

Jérôme LELEU

unread,
Nov 13, 2020, 11:32:17 AM11/13/20
to Frédéric Lohier, CAS Community
Hi,

Yes, I have an issue with the version 6.2.3 too, I can't download it.

I just set up a Maven overlay based on the cas-mgmt-webapp v6.2.2, but I only see pac4j-* v4.0.3 dependencies in the WEB-INF/lib.

I don't know how you can get pac4j-core v4.1.0. Don't you have other dependencies? What do you get with: ./gradlew allDependencies in terms of pac4j dependencies?

Thanks.
Best regards,
Jérôme

Frédéric Lohier

unread,
Nov 16, 2020, 7:59:39 AM11/16/20
to CAS Community, leleuj, CAS Community, Frédéric Lohier
Hello,

Thank you for the gradlew dependencies tip which allowed me to move forward.
The pac4j-core v4.1.0 dependency comes from CAS 6.2.5 (in the gradle.properties of the cas-management overlay project, I have cas.version=6.2.5 which matches the version of my cas server deployment) and the fact that added the dependency implementation "org.apereo.cas:cas-server-support-json-service-registry:${project.'cas.version'}" in the build.gradle (same with git service registry implementation that I used initially).

The gradlew dependencies results shows : 

runtimeClasspath - Runtime classpath of source set 'main'.
\--- org.apereo.cas:cas-server-support-json-service-registry:6.2.5
     +--- org.aspectj:aspectjrt:1.9.5
     +--- org.aspectj:aspectjweaver:1.9.5
     +--- javax.validation:validation-api:2.0.1.Final
     +--- org.apereo.cas:cas-server-core-services:6.2.5
     |    +--- org.aspectj:aspectjrt:1.9.5
     |    +--- org.aspectj:aspectjweaver:1.9.5
     |    +--- javax.validation:validation-api:2.0.1.Final
     |    +--- org.apereo.cas:cas-server-core-services-api:6.2.5
     |    |    +--- org.aspectj:aspectjrt:1.9.5
     |    |    +--- org.aspectj:aspectjweaver:1.9.5
     |    |    +--- javax.validation:validation-api:2.0.1.Final
     |    |    +--- org.apereo.cas:cas-server-core-util-api:6.2.5
     |    |    |    +--- org.aspectj:aspectjrt:1.9.5
     |    |    |    +--- org.aspectj:aspectjweaver:1.9.5
     |    |    |    +--- javax.validation:validation-api:2.0.1.Final
     |    |    |    +--- org.bitbucket.b_c:jose4j:0.7.1
     |    |    |    +--- org.pac4j:pac4j-config:4.1.0
     |    |    |    |    \--- org.pac4j:pac4j-core:4.1.0
     |    |    |    +--- org.pac4j:pac4j-core:4.1.0
     |    |    |    +--- org.pac4j:pac4j-http:4.1.0
     |    |    |    |    \--- org.pac4j:pac4j-core:4.1.0
     |    |    |    +--- org.pac4j:spring-webmvc-pac4j:4.0.1

If I set cas.version=6.2.3 in the gradle.properties of the cas-management overlay project, then the gradlew dependencies shows :

runtimeClasspath - Runtime classpath of source set 'main'.
\--- org.apereo.cas:cas-server-support-json-service-registry:6.2.3
     +--- org.aspectj:aspectjrt:1.9.5
     +--- org.aspectj:aspectjweaver:1.9.5
     +--- javax.validation:validation-api:2.0.1.Final
     +--- org.apereo.cas:cas-server-core-services:6.2.3
     |    +--- org.aspectj:aspectjrt:1.9.5
     |    +--- org.aspectj:aspectjweaver:1.9.5
     |    +--- javax.validation:validation-api:2.0.1.Final
     |    +--- org.apereo.cas:cas-server-core-services-api:6.2.3
     |    |    +--- org.aspectj:aspectjrt:1.9.5
     |    |    +--- org.aspectj:aspectjweaver:1.9.5
     |    |    +--- javax.validation:validation-api:2.0.1.Final
     |    |    +--- org.apereo.cas:cas-server-core-util-api:6.2.3
     |    |    |    +--- org.aspectj:aspectjrt:1.9.5
     |    |    |    +--- org.aspectj:aspectjweaver:1.9.5
     |    |    |    +--- javax.validation:validation-api:2.0.1.Final
     |    |    |    +--- org.bitbucket.b_c:jose4j:0.7.1
     |    |    |    +--- org.pac4j:pac4j-config:4.0.3
     |    |    |    |    \--- org.pac4j:pac4j-core:4.0.3
     |    |    |    +--- org.pac4j:pac4j-core:4.0.3
     |    |    |    +--- org.pac4j:pac4j-http:4.0.3
     |    |    |    |    \--- org.pac4j:pac4j-core:4.0.3
     |    |    |    +--- org.pac4j:spring-webmvc-pac4j:4.0.1

and I can log into the cas-management, but the cas server version does not match and I don't know the potential consequences. 

CAS Management 6.2.3 seems to be fixing this pac4j dependency issue but I when I try to build it with the following gradle.properties :

casmgmt.version=6.2.3
cas.version=6.2.5
springBootVersion=2.2.8.RELEASE
appServer=-tomcat
sourceCompatibility=11
targetCompatibility=11
gradleMavenPluginVersion=5.1.1

I get the following error : 

Could not determine the dependencies of task ':extractCasBootWarOverlay'.
> Could not resolve all files for configuration ':casBootWarOverlay'.
   > Could not resolve org.apereo.cas:cas-mgmt-webapp-tomcat:6.2.3.
     Required by:
         project :
      > Could not resolve org.apereo.cas:cas-mgmt-webapp-tomcat:6.2.3.

-Frederic

Jérôme LELEU

unread,
Nov 16, 2020, 8:53:12 AM11/16/20
to Frédéric Lohier, CAS Community
Hi,

You could also explicitly set the pac4j-* dependencies with the version 4.0.3.
All the 4.x versions are compatible as long as the pac4j-core and other pac4j-* dependencies are on the same version.
Thanks.
Best regards,
Jérôme


Ray Bon

unread,
Nov 16, 2020, 9:32:57 AM11/16/20
to cas-...@apereo.org, lel...@gmail.com, fred...@lohier.org
Frédéric,

There should be no problem using the latest cas-management. It is a completely separate application and should not conflict with cas.

Ray

On Mon, 2020-11-16 at 04:59 -0800, Frédéric Lohier wrote:
Notice: This message was sent from outside the University of Victoria email system. Please be cautious with links and sensitive information.
-- 
Ray Bon
Programmer Analyst
Development Services, University Systems

I respectfully acknowledge that my place of work is located within the ancestral, traditional and unceded territory of the Songhees, Esquimalt and WSÁNEĆ Nations.
Reply all
Reply to author
Forward
0 new messages