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

   The OpenID Connect login of #643 uses the Keycloak client of pac4j and its 
roles generator, so it works only with Keycloak. This makes it work with any 
OpenID Connect provider, as Google or Microsoft Entra ID (Azure), which speak 
standard OpenID Connect.
   
   This depends on #643, so the commits of that PR are included here. The new 
one is the last: JSPWIKI-1375 Make the OpenID Connect login work with any 
OpenID Connect provider. When #643 is merged I will rebase this on master.
   
   cc @spyhunter99 @juanpablo-santos
   
   What changes:
   - The generic OpenID Connect client of pac4j is configured with the 
discovery address of the provider, instead of the Keycloak client with its 
realm and base address.
   - The claim with the name of the user is configurable (oidc.usernameClaim, 
preferred_username by default, then the e-mail address, then the identifier of 
the user at the provider).
   - The claim with the roles is configurable (oidc.rolesClaim). It is searched 
in the profile and in the access token when this is a JWT, and it may be a 
dotted path through nested claims: realm_access.roles for Keycloak, roles for 
the application roles of Azure.
   - An optional mapping (oidc.roleMapping) turns the values of that claim into 
roles of the wiki, for the providers that send identifiers instead of names.
   - The callback address has no parameters, so it can be registered as is in 
the provider; Azure and Google need an exact address.
   - The README describes the settings, and the configuration for Keycloak, 
Azure and Google.
   
   I checked it with a real Keycloak used as a generic provider, the wiki with 
its pages in Tomcat, and two configurations:
   - Keycloak style (oidc.rolesClaim=realm_access.roles): a normal user logs in 
and gets 403 on a page that needs Admin; the administrator sees it. Log out 
returns to the wiki, and Keycloak asks for the credentials again.
   - Azure and Google style (oidc.usernameClaim=email, oidc.rolesClaim=roles 
with a flat claim, and oidc.roleMapping=Authenticated=Admin): the wiki shows 
the e-mail address as the name, and the normal user, who got the 403 before, 
sees the Admin page, so the role mapping works.
   - The unit tests of the new classes pass (18 in the module).
   
   I did not try it with Google or Azure themselves, as that needs an 
application registered in each. The configurations in the README follow what 
those providers document.


-- 
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