Reputation: 11
Currently I am using Pac4j jee-pac4j.version 5.0.1-SNAPSHOT in JAVA 8 , I have a scenario where I need to inject the scope externally to test my application with different scope settings passed through a UI.
Is there any possible way i can do this.
Can you please suggest me a solution for the same.
I tried extending DemoConfigFactory Class and setScope for each client retriving them through config:
configFactory.build("openid profile").getClients().getClients().forEach(client -> {
if (client instanceof GoogleOidcClient) {
GoogleOidcClient oidcClient = (GoogleOidcClient) client;
oidcClient.getConfiguration().setScope(selectedScope);
}
});
its not adding the scopes or updating in the Configuration.
Upvotes: 0
Views: 116
Reputation: 2699
By default, clients are lazily initialized so if the client is already initialized, you can't change its configuration.
Why not update the XXXConfigFactory
and set the scope at this stage?
Upvotes: 0