javaopenid-connectpac4j

How to change the name of the OIDC Client in pac4j


I am experimenting with the pac4j in order to add OIDC to a webapp. I started with the jee-pac4j-demo app.

From there I intend to go to a different OIDC Client.

I changed

I got a malformed_url error from Google.

Then I just get an "unauthorized".

Is GoogleOidcClient not supposed to be tampered with?

Is setName the wrong approach?

Is there a tutorial on how to add a "random" OIDC Client to the pac4j configuration?

Why does the logging still refer to localhost:8080?

JEE PAC4J DEMO 09:55:45.735 [http-nio-8080-exec-52] DEBUG o.p.core.engine.DefaultSecurityLogic - url: http://localhost:8080/jee-pac4j-demo/oidc/index.jsp
JEE PAC4J DEMO 09:55:45.735 [http-nio-8080-exec-52] DEBUG o.p.core.engine.DefaultSecurityLogic - clients: GoogleOidcClient | matchers: null
JEE PAC4J DEMO 09:55:45.735 [http-nio-8080-exec-52] DEBUG o.p.core.engine.DefaultSecurityLogic - currentClients: []
JEE PAC4J DEMO 09:55:45.735 [http-nio-8080-exec-52] DEBUG o.p.core.engine.DefaultSecurityLogic - Loaded profiles (from session: true): []
JEE PAC4J DEMO 09:55:45.735 [http-nio-8080-exec-52] DEBUG o.p.core.engine.DefaultSecurityLogic - unauthorized

Solution

  • To change the name of a client, client.setName("xxx"); is the appropriate thing to do.

    Sometimes, depending on the provider, there might be an issue with the fact that the client name is a request parameter. You can apply the client name on the path if need be: https://www.pac4j.org/5.7.x/docs/clients.html#3-the-callback-url