@Test public void testRoleFiltering() { final Collection<AuthenticationProvider> authenticationProviders = reverseProxyIdolSecurityCustomizer.getAuthenticationProviders(); assertThat(authenticationProviders, hasSize(1)); final Authentication authentication = authenticationProviders.stream() .map(authenticationProvider -> authenticationProvider.authenticate(this.foreignAuthentication)) .findFirst() .orElseThrow(() -> new AssertionError("AuthenticationProvider did not authenticate")); assertThat(authentication.getAuthorities(), contains(authority("FindAdmin"), authority("FindUser"), authority("FindBI"))); }
@Override public Collection<AuthenticationProvider> getAuthenticationProviders() { return Collections.singleton(new IdolPreAuthenticatedAuthenticationProvider( userService, grantedAuthoritiesMapper, Arrays.stream(preAuthenticatedRoles.split(",")) .map(FindCommunityRole::fromValue) .map(FindCommunityRole::value) .collect(Collectors.toSet()) )); }
ReverseProxyIdolSecurityCustomizer implements IdolSecurityCustomizer { @Override public Collection<AuthenticationProvider> getAuthenticationProviders() { return Collections.singleton(new IdolPreAuthenticatedAuthenticationProvider( userService, grantedAuthoritiesMapper, Arrays.stream(preAuthenticatedRoles.split(",")) .map(FindCommunityRole::fromValue) .map(FindCommunityRole::value) .collect(Collectors.toSet()) )); } }
ReverseProxyIdolSecurityCustomizer implements IdolSecurityCustomizer { @Override public Collection<AuthenticationProvider> getAuthenticationProviders() { return Collections.singleton(new IdolPreAuthenticatedAuthenticationProvider( userService, grantedAuthoritiesMapper, Arrays.stream(preAuthenticatedRoles.split(",")) .map(FindCommunityRole::fromValue) .map(FindCommunityRole::value) .collect(Collectors.toSet()) )); } @Autowired  ReverseProxyIdolSecurityCustomizer(
            final UserService userService,
            final GrantedAuthoritiesMapper grantedAuthoritiesMapper,
            @Value("${find.reverse-proxy.pre-authenticated-roles}") final String preAuthenticatedRoles,
            @Value("${find.reverse-proxy.pre-authenticated-username}") final String preAuthenticatedUsername
    ); }
ReverseProxyIdolSecurityCustomizer implements IdolSecurityCustomizer { @Override public Collection<AuthenticationProvider> getAuthenticationProviders() { return Collections.singleton(new IdolPreAuthenticatedAuthenticationProvider( userService, grantedAuthoritiesMapper, Arrays.stream(preAuthenticatedRoles.split(",")) .map(FindCommunityRole::fromValue) .map(FindCommunityRole::value) .collect(Collectors.toSet()) )); } @Autowired  ReverseProxyIdolSecurityCustomizer(
            final UserService userService,
            final GrantedAuthoritiesMapper grantedAuthoritiesMapper,
            @Value("${find.reverse-proxy.pre-authenticated-roles}") final String preAuthenticatedRoles,
            @Value("${find.reverse-proxy.pre-authenticated-username}") final String preAuthenticatedUsername
    ); @SuppressWarnings("ProhibitedExceptionDeclared") @Override void customize(final HttpSecurity http, final AuthenticationManager authenticationManager); @Override Collection<AuthenticationProvider> getAuthenticationProviders(); }
ReverseProxyIdolSecurityCustomizer implements IdolSecurityCustomizer { @Override public Collection<AuthenticationProvider> getAuthenticationProviders() { return Collections.singleton(new IdolPreAuthenticatedAuthenticationProvider( userService, grantedAuthoritiesMapper, Arrays.stream(preAuthenticatedRoles.split(",")) .map(FindCommunityRole::fromValue) .map(FindCommunityRole::value) .collect(Collectors.toSet()) )); } @Autowired  ReverseProxyIdolSecurityCustomizer(
            final UserService userService,
            final GrantedAuthoritiesMapper grantedAuthoritiesMapper,
            @Value("${find.reverse-proxy.pre-authenticated-roles}") final String preAuthenticatedRoles,
            @Value("${find.reverse-proxy.pre-authenticated-username}") final String preAuthenticatedUsername
    ); @SuppressWarnings("ProhibitedExceptionDeclared") @Override void customize(final HttpSecurity http, final AuthenticationManager authenticationManager); @Override Collection<AuthenticationProvider> getAuthenticationProviders();  }