Repository navigation
JSPWIKI-94 Log in with OpenID Connect through Keycloak - #643
arturobernalg wants to merge 5 commits into
Conversation
A new jspwiki-oidc module uses the pac4j filters to send the user to the identity provider and a filter that presents the logged in user to the wiki as a container login. The wiki recognizes the user as authenticated without changes in its authentication code. Work in progress, not ready for review.
…d a test The filters of the proof of concept are commented out in web.xml, as the container managed authentication section is, and the war does not include the module. Adds the ChangeLog entry and a test of the request wrapper.
…onnect module OidcAuthorizer declares that the container handles the login and takes the roles from the property jspwiki.oidc.roles, so Login.jsp and the roles of the identity provider work as with a container login. The logout filter ends the session of the identity provider and returns to the wiki. The war includes the module with the profile oidc. Adds the tests of the authorizer and a description of how to enable it.
|
it should work, however it might be helpful if had something a bit more specific for kc. i.e. when creating the user account, automatically set the full name, email address, etc. i'm not sure if it does this currently. it should be possible, i think. i would suggest another jspwiki-it-* module for this along with some rough high level directions to setup keycloak for the test. i have some drafted if you need assistance. |
|
Thanks Alex. The name and the e-mail are done in #644, which builds on this one: the first login creates the profile with the claims name and email, and an existing profile is not changed. I checked it with Keycloak: the profile had the full name and the e-mail of the test user, and a second login did not touch it. About the jspwiki-it module: #644 also adds OidcLoginFlowTest, which runs the login, the identity and the logout in an embedded Tomcat against a provider that runs in the test, so it needs no Docker and runs in the normal build. It does not start the wiki and it does not use Keycloak itself. If you think a module against a real Keycloak is still worth it, I would be glad to use your drafts for the setup directions. |
…4-oidc # Conflicts: # jspwiki-api/src/main/java/org/apache/wiki/api/Release.java
Adds optional OpenID Connect login to JSPWiki, as asked in JSPWIKI-94, following the guide Alex attached to the ticket. It has been tried with Keycloak.
cc @spyhunter99 @juanpablo-santos, could you review it?
How it works: the pac4j filters send the user to the identity provider and receive the answer. 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. OidcAuthorizer, an authorizer for jspwiki.authorizer, declares that the container handles the login, so Login.jsp behaves as with a container login, and takes the role names from jspwiki.oidc.roles (Admin and Authenticated by default).
What the PR contains:
I checked it with a real Keycloak and the wiki with its pages in Tomcat:
It uses the Keycloak client of pac4j, as the attachment does. It adds pac4j (pac4j-oidc 6.5.5, jakartaee-pac4j 8.0.3) as dependencies of the new module, only included in the war with the profile.
I did not try other identity providers, nor the portable build.