arturobernalg opened a new pull request, #643:
URL: https://github.com/apache/jspwiki/pull/643

   Proof of concept for JSPWIKI-94, to be analyzed. It is not ready to merge. 
Following the guide Alex attached to the ticket, it shows that the wiki can 
authenticate users with OpenID Connect without changes in its authentication 
code.
   
   cc @spyhunter99 @juanpablo-santos, could you review the approach?
   
   How it works: the pac4j filters send the user to the identity provider and 
receive the answer. A new filter, OidcIdentityFilter, runs before the filters 
of the wiki and presents the logged in user as a user authenticated by the 
container, through getRemoteUser(), getUserPrincipal() and isUserInRole(). The 
web.xml already documents that a filter placed before WikiServletFilter that 
returns these values makes the wiki treat the user as authenticated.
   
   What the PR contains:
   - The new module jspwiki-oidc: OidcConfigFactory (reads 
jspwiki-oidc.properties), OidcIdentityFilter and OidcRequestWrapper, with a 
test of the wrapper.
   - The filters in web.xml, commented out as the container managed section is. 
The war does not include the module, so nothing changes by default.
   - /oidc/login.jsp, the entry point that redirects to the front page after 
the login.
   
   I checked it with a real Keycloak and the wiki in Tomcat: the login at 
Keycloak, the return to the wiki, and the wiki showing the user as 
authenticated (G'day, kcuser (authenticated)), with the login event registered.
   
   Open points:
   - The roles of Keycloak are mapped to isUserInRole(), but I did not exercise 
them, and security-role is not declared for them in web.xml.
   - Logout is not implemented, and the Login link of the interface still goes 
to Login.jsp. Login.jsp answers Forbidden to a user who is already 
authenticated when the container has no security constraints, which is why the 
entry point is /oidc/login.jsp.
   - It uses the Keycloak client of pac4j, as the attachment does. A generic 
OpenID Connect client would work with other providers.
   - It adds pac4j (pac4j-oidc 6.5.5, jakartaee-pac4j 8.0.3) as dependencies of 
the new module.
   
   The module is built with the rest, and its test passes.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to