src/main/java/com/initialspark/nhslogin/demo/config/WebSecurityConfig.java
/**
     * Create and configure the MITREid Connect client filter
     *
     * @return
     * @throws Exception
     */
Create and configure the MITREid Connect client filter
@return
@throws Exception
Create and configure the MITREid Connect client filter @return @throws Exception
@Bean
    public OIDCAuthenticationFilter configureOIDCFilter() throws Exception {
        OIDCAuthenticationFilter filter = new OIDCAuthenticationFilter();
        StaticSingleIssuerService issuerService = new StaticSingleIssuerService();
        issuerService.setIssuer(issuerUri);
        filter.setIssuerService(issuerService);
        filter.setServerConfigurationService(new DynamicServerConfigurationService());
        StaticClientConfigurationService clientService = new StaticClientConfigurationService();
        RegisteredClient client = new RegisteredClient();
        client.setClientId(clientId);
        client.setScope(getScopes());
        client.setTokenEndpointAuthMethod(AuthMethod.PRIVATE_KEY);
        client.setRedirectUris(ImmutableSet.of(redirectUri));
        clientService.setClients(ImmutableMap.of(issuerUri, client));
        filter.setClientConfigurationService(clientService);
        filter.setAuthRequestOptionsService(getStaticAuthRequestOptionsService());
        filter.setAuthRequestUrlBuilder(new PlainAuthRequestUrlBuilder());
        filter.setAuthenticationManager(authenticationManager());
        return filter;
    }
@ Bean public OIDCAuthenticationFilter configureOIDCFilter ( ) throws Exception { OIDCAuthenticationFilter filter = new OIDCAuthenticationFilter ( ) ; StaticSingleIssuerService issuerService = new StaticSingleIssuerService ( ) ; issuerService . setIssuer ( issuerUri ) ; filter . setIssuerService ( issuerService ) ; filter . setServerConfigurationService ( new DynamicServerConfigurationService ( ) ) ; StaticClientConfigurationService clientService = new StaticClientConfigurationService ( ) ; RegisteredClient client = new RegisteredClient ( ) ; client . setClientId ( clientId ) ; client . setScope ( getScopes ( ) ) ; client . setTokenEndpointAuthMethod ( AuthMethod . PRIVATE_KEY ) ; client . setRedirectUris ( ImmutableSet . of ( redirectUri ) ) ; clientService . setClients ( ImmutableMap . of ( issuerUri , client ) ) ; filter . setClientConfigurationService ( clientService ) ; filter . setAuthRequestOptionsService ( getStaticAuthRequestOptionsService ( ) ) ; filter . setAuthRequestUrlBuilder ( new PlainAuthRequestUrlBuilder ( ) ) ; filter . setAuthenticationManager ( authenticationManager ( ) ) ; return filter ; }
Create and configure the MITREid Connect client filter
 @return
 @throws Exception
Create and configure the MITREid Connect client filter @return @throws Exception
// This tells the client to use a signed JWT to authenticate itself against token endpoint