You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "bonampak (via GitHub)" <gi...@apache.org> on 2025/11/24 20:03:40 UTC

[PR] KNOX-3217: Upgrade pac4j to 6.3.0 for JDK17 [knox]

bonampak opened a new pull request, #1110:
URL: https://github.com/apache/knox/pull/1110

   
   
   [KNOX-3217](https://issues.apache.org/jira/browse/KNOX-3217) - Update pac4j-related libraries to the latest version available.
   
   ## What changes were proposed in this pull request?
   
   Update javaee-pac4j to 8.1.0, pac4j to 6.3.0 and opensaml to 5.1.6.
   
   ## How was this patch tested?
   
   Not tested yet. Build passes, but spring vault tests fail. Will test with Keycloak and CAS. 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@knox.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KNOX-3217: Upgrade pac4j to 6.3.0 for JDK17 [knox]

Posted by "moresandeep (via GitHub)" <gi...@apache.org>.
moresandeep commented on PR #1110:
URL: https://github.com/apache/knox/pull/1110#issuecomment-3612726501

   @bonampak did you test it with AzureAD?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@knox.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KNOX-3217: Upgrade pac4j to 6.3.0 for JDK17 [knox]

Posted by "bonampak (via GitHub)" <gi...@apache.org>.
bonampak commented on PR #1110:
URL: https://github.com/apache/knox/pull/1110#issuecomment-3613182890

   Yes I did.
   Using these settings:
   ```xml
   <provider>
               <role>federation</role>
               <name>pac4j</name>
               <enabled>true</enabled>
               <param>
                   <name>pac4j.callbackUrl</name>
                   <value>https://localhost:8443/gateway/knoxsso/api/v1/websso</value>
               </param>
               <param>
                   <name>clientName</name>
                   <value>AzureAd2Client</value>
               </param>
               <param>
                   <name>oidc.type</name>
                   <value>azure</value>
               </param>
               <param>
                   <name>oidc.id</name>
                   <value>...</value>
               </param>
               <param>
                   <name>oidc.secret</name>
                   <value>...</value>
               </param>
               <param>
                   <name>oidc.azure.tenant</name>
                   <value>...</value>
               </param>
               <param>
                   <name>oidc.discoveryUri</name>
                   <value>https://login.microsoftonline.com/.../v2.0/.well-known/openid-configuration</value>
               </param>
               <param>
                   <name>oidc.clientAuthenticationMethod</name>
                   <value>client_secret_basic</value>
               </param>
               <param>
                   <name>oidc.preferredJwsAlgorithm</name>
                   <value>RS256</value>
               </param>
           </provider>
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@knox.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KNOX-3217: Upgrade pac4j to 6.3.0 for JDK17 [knox]

Posted by "moresandeep (via GitHub)" <gi...@apache.org>.
moresandeep commented on code in PR #1110:
URL: https://github.com/apache/knox/pull/1110#discussion_r2588658924


##########
gateway-provider-security-pac4j/pom.xml:
##########
@@ -28,6 +28,19 @@
     <name>gateway-provider-security-pac4j</name>
     <description>An extension of the gateway integrating pac4j as an authentication provider.</description>
 
+    <repositories>
+        <repository>

Review Comment:
   Why do we need to add shibboleth repo?



##########
gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jIdentityAdapter.java:
##########
@@ -84,13 +89,18 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo
 
     final HttpServletRequest request = (HttpServletRequest) servletRequest;
     final HttpServletResponse response = (HttpServletResponse) servletResponse;
-    final JEEContext context = new JEEContext(request, response, ((Config)request.getAttribute(PAC4J_CONFIG)).getSessionStore());
-    final ProfileManager<CommonProfile> manager = new ProfileManager<>(context);
-    final Optional<CommonProfile> optional = manager.get(true);
+    final JEEContext context = new JEEContext(request, response);
+    Config pac4jConfig = ((Config)request.getAttribute(PAC4J_CONFIG));
+    FrameworkParameters frameworkParameters = new JEEFrameworkParameters(request, response);
+    SessionStore sessionStore = pac4jConfig.getSessionStoreFactory().newSessionStore(frameworkParameters);
+    final ProfileManager manager = new ProfileManager(context, sessionStore);
+    final Optional<UserProfile> optional = manager.getProfile();
     if (optional.isPresent()) {
-      CommonProfile profile = optional.get();
+      UserProfile profile = optional.get();
       logger.debug("User authenticated as: {}", profile);
-      manager.remove(true);
+      //manager.removeProfiles(); would only work if session existed, but our session store does not support sessions

Review Comment:
   Let's remove the commented out line.



##########
gateway-provider-security-pac4j/pom.xml:
##########
@@ -28,6 +28,19 @@
     <name>gateway-provider-security-pac4j</name>
     <description>An extension of the gateway integrating pac4j as an authentication provider.</description>
 
+    <repositories>
+        <repository>

Review Comment:
   I found my answer at the bottom :) 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@knox.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KNOX-3217: Upgrade pac4j to 6.3.0 for JDK17 [knox]

Posted by "bonampak (via GitHub)" <gi...@apache.org>.
bonampak merged PR #1110:
URL: https://github.com/apache/knox/pull/1110


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@knox.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KNOX-3217: Upgrade pac4j to 6.3.0 for JDK17 [knox]

Posted by "bonampak (via GitHub)" <gi...@apache.org>.
bonampak commented on code in PR #1110:
URL: https://github.com/apache/knox/pull/1110#discussion_r2589082611


##########
gateway-provider-security-pac4j/src/main/java/org/apache/knox/gateway/pac4j/filter/Pac4jIdentityAdapter.java:
##########
@@ -84,13 +89,18 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo
 
     final HttpServletRequest request = (HttpServletRequest) servletRequest;
     final HttpServletResponse response = (HttpServletResponse) servletResponse;
-    final JEEContext context = new JEEContext(request, response, ((Config)request.getAttribute(PAC4J_CONFIG)).getSessionStore());
-    final ProfileManager<CommonProfile> manager = new ProfileManager<>(context);
-    final Optional<CommonProfile> optional = manager.get(true);
+    final JEEContext context = new JEEContext(request, response);
+    Config pac4jConfig = ((Config)request.getAttribute(PAC4J_CONFIG));
+    FrameworkParameters frameworkParameters = new JEEFrameworkParameters(request, response);
+    SessionStore sessionStore = pac4jConfig.getSessionStoreFactory().newSessionStore(frameworkParameters);
+    final ProfileManager manager = new ProfileManager(context, sessionStore);
+    final Optional<UserProfile> optional = manager.getProfile();
     if (optional.isPresent()) {
-      CommonProfile profile = optional.get();
+      UserProfile profile = optional.get();
       logger.debug("User authenticated as: {}", profile);
-      manager.remove(true);
+      //manager.removeProfiles(); would only work if session existed, but our session store does not support sessions

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@knox.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org