How to configure userInfoUri and tokenUri properties dynamically for federation on each request in spring security?

58 Views Asked by At

currently we are supporting federation . I have a scenario where based on authorization code I need to modify userInfoUri and tokenUri on each request .

Basically its dependent on authorization code because of which uri may change .

Is there a way in which based on some condition below created userInfoUri and tokenUri can be modified ?

  @Bean
    public ClientRegistrationRepository clientRegistrationRepository() {
        return new InMemoryClientRegistrationRepository(this.ciscoClientRegistration());
    }


public ClientRegistration ciscoClientRegistration() {
        return ClientRegistration
        .withRegistrationId("project")                         .clientId("clientid")
.clientSecret("clientsecret")
            .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC)
                .redirectUri(redirectUri)
                .scope(new ArrayList<String>(Arrays.asList(scope.split(","))))
                .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
                .authorizationUri(authorizationURI)
                .tokenUri(tokenURI)
                .userInfoUri(userInfoURI)
                .userNameAttributeName(userNameAttributes)
                .build();
    }
0

There are 0 best solutions below