Pac4j Customizing Token Endpoint call which is added in the configuration

75 views Asked by At

I am Using Pac4j 5.0X with Java 8 Jee Project which is maven based. For reference:: [https://github.com/pac4j/jee-pac4j-demo/tree/5.0.x][1]

Whenever pac4j is initiating a Token call via tokenEndpoint which i have configured in

oidcProviderMetadata.setTokenEndpointURI(tokenEndpointURI);
oidcConfiguration.setProviderMetadata(oidcProviderMetadata); 

i have added some custom fields in the token url appended while setting up the configuration. which looks as::

 tokenEndpointURI=new URI(appConfig.getTokenEndpoint()+"?fieldA="+ Constants.fieldA);

Initially i am trying to set the constant field while configuration which is fieldA.

I have a requirment where i need to send an updated fieldA value which each request i am initating the authentication.

I have extended OidcProfileCreator i can see the Userinfo end point but not sure where i can satisfy my requirement for tokenendpoint Url using this library.

So is there a way to update the token call attributes before each time it's triggered?

Can you please help me out on this provide me an alternative solution to intercept and update the token call before it is initiated.??

1

There are 1 answers

2
jleleu On

The token endpoint call is made in the OidcAuthenticator: you should override this class and not the OidcProfileCreator (which is indeed related to the user info endpoint).