Java Code Examples for org.springframework.security.saml.SAMLAuthenticationProvider
The following examples show how to use
org.springframework.security.saml.SAMLAuthenticationProvider. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-boot-security-saml Source File: AuthenticationProviderConfigurerTest.java License: MIT License | 6 votes |
@Test public void testArguments() throws Exception { AuthenticationProviderConfigurer configurer = new AuthenticationProviderConfigurer(); configurer .excludeCredential(true) .forcePrincipalAsString(false); configurer.init(builder); configurer.configure(builder); ArgumentCaptor<SAMLAuthenticationProvider> providerCaptor = ArgumentCaptor.forClass(SAMLAuthenticationProvider.class); verify(builder).setSharedObject(eq(SAMLAuthenticationProvider.class), providerCaptor.capture()); verifyZeroInteractions(authProviderProperties); assertThat(providerCaptor.getValue()).isNotNull(); SAMLAuthenticationProvider authenticationProvider = providerCaptor.getValue(); assertThat(authenticationProvider.isExcludeCredential()).isTrue(); assertThat(authenticationProvider.isForcePrincipalAsString()).isFalse(); assertThat(authenticationProvider.getUserDetails()).isExactlyInstanceOf(SimpleSAMLUserDetailsService.class); }
Example 2
Source Project: spring-boot-security-saml Source File: SAMLServiceProviderSecurityConfiguration.java License: MIT License | 5 votes |
@Override public void afterPropertiesSet() { //All existing beans are thrown as shared objects to the ServiceProviderSecurityBuilder, which will wire all //beans/objects related to spring security SAML. serviceProviderBuilder.setSharedObject(ParserPool.class, ParserPoolHolder.getPool()); serviceProviderBuilder.setSharedObject(WebSSOProfileConsumerImpl.class, (WebSSOProfileConsumerImpl) webSSOProfileConsumer); serviceProviderBuilder.setSharedObject(WebSSOProfileConsumerHoKImpl.class, hokWebSSOProfileConsumer); serviceProviderBuilder.setSharedObject(ServiceProviderEndpoints.class, new ServiceProviderEndpoints()); serviceProviderBuilder.setSharedObject(ResourceLoader.class, resourceLoader); serviceProviderBuilder.setSharedObject(SAMLSSOProperties.class, sAMLSsoProperties); serviceProviderBuilder.setSharedObject(ExtendedMetadata.class, extendedMetadata); serviceProviderBuilder.setSharedObject(LocalExtendedMetadata.class, localExtendedMetadata); serviceProviderBuilder.setSharedObject(SAMLAuthenticationProvider.class, samlAuthenticationProvider); serviceProviderBuilder.setSharedObject(SAMLContextProvider.class, samlContextProvider); serviceProviderBuilder.setSharedObject(KeyManager.class, keyManager); serviceProviderBuilder.setSharedObject(MetadataManager.class, metadataManager); serviceProviderBuilder.setSharedObject(MetadataGenerator.class, metadataGenerator); serviceProviderBuilder.setSharedObject(SAMLProcessor.class, samlProcessor); serviceProviderBuilder.setSharedObject(WebSSOProfile.class, webSSOProfile); serviceProviderBuilder.setSharedObject(WebSSOProfileECPImpl.class, ecpProfile); serviceProviderBuilder.setSharedObject(WebSSOProfileHoKImpl.class, hokWebSSOProfile); serviceProviderBuilder.setSharedObject(SingleLogoutProfile.class, sloProfile); serviceProviderBuilder.setSharedObject(WebSSOProfileConsumer.class, webSSOProfileConsumer); serviceProviderBuilder.setSharedObject(WebSSOProfileConsumerHoKImpl.class, hokWebSSOProfileConsumer); serviceProviderBuilder.setSharedObject(SAMLLogger.class, samlLogger); serviceProviderBuilder.setSharedObject(ApplicationEventPublisher.class, eventPublisher); }
Example 3
Source Project: spring-boot-security-saml Source File: AuthenticationProviderConfigurerTest.java License: MIT License | 5 votes |
@Before public void setup() { SAMLSSOProperties properties = mock(SAMLSSOProperties.class); authProviderProperties = mock(AuthenticationProviderProperties.class); when(properties.getAuthenticationProvider()).thenReturn(authProviderProperties); when(authProviderProperties.isExcludeCredential()).thenReturn(false); when(authProviderProperties.isForcePrincipalAsString()).thenReturn(false); builder = mock(ServiceProviderBuilder.class); when(builder.getSharedObject(SAMLAuthenticationProvider.class)).thenReturn(null); when(builder.getSharedObject(SAMLSSOProperties.class)).thenReturn(properties); }
Example 4
Source Project: spring-boot-security-saml Source File: AuthenticationProviderConfigurerTest.java License: MIT License | 5 votes |
@Test public void init() throws Exception { AuthenticationProviderConfigurer configurer = new AuthenticationProviderConfigurer(); configurer.init(builder); verify(builder).getSharedObject(eq(SAMLAuthenticationProvider.class)); verify(builder).getSharedObject(eq(SAMLSSOProperties.class)); }
Example 5
Source Project: spring-boot-security-saml Source File: AuthenticationProviderConfigurerTest.java License: MIT License | 5 votes |
@Test public void configure() throws Exception { AuthenticationProviderConfigurer configurer = new AuthenticationProviderConfigurer(); configurer.init(builder); configurer.configure(builder); verify(builder).setSharedObject(eq(SAMLAuthenticationProvider.class), any(SAMLAuthenticationProvider.class)); }
Example 6
Source Project: spring-boot-security-saml Source File: AuthenticationProviderConfigurerTest.java License: MIT License | 5 votes |
@Test public void configure_forBean() throws Exception { SAMLAuthenticationProvider samlAuthenticationProvider = mock(SAMLAuthenticationProvider.class); when(builder.getSharedObject(SAMLAuthenticationProvider.class)).thenReturn(samlAuthenticationProvider); AuthenticationProviderConfigurer configurer = new AuthenticationProviderConfigurer(); configurer.init(builder); configurer.configure(builder); verify(builder, never()).setSharedObject(any(), any()); verifyZeroInteractions(samlAuthenticationProvider, authProviderProperties); }
Example 7
Source Project: spring-boot-security-saml Source File: AuthenticationProviderConfigurerTest.java License: MIT License | 5 votes |
@Test public void configure_forConstructor() throws Exception { SAMLAuthenticationProvider samlAuthenticationProvider = mock(SAMLAuthenticationProvider.class); AuthenticationProviderConfigurer configurer = new AuthenticationProviderConfigurer(samlAuthenticationProvider); configurer.init(builder); configurer.configure(builder); verify(builder).setSharedObject(eq(SAMLAuthenticationProvider.class), eq(samlAuthenticationProvider)); verifyZeroInteractions(samlAuthenticationProvider, authProviderProperties); }
Example 8
Source Project: spring-boot-security-saml Source File: AuthenticationProviderConfigurerTest.java License: MIT License | 5 votes |
@Test public void testProperties() throws Exception { AuthenticationProviderConfigurer configurer = new AuthenticationProviderConfigurer(); configurer.init(builder); configurer.configure(builder); ArgumentCaptor<SAMLAuthenticationProvider> providerCaptor = ArgumentCaptor.forClass(SAMLAuthenticationProvider.class); verify(builder).setSharedObject(eq(SAMLAuthenticationProvider.class), providerCaptor.capture()); verify(authProviderProperties).isExcludeCredential(); verify(authProviderProperties).isForcePrincipalAsString(); assertThat(providerCaptor.getValue()).isNotNull(); SAMLAuthenticationProvider authenticationProvider = providerCaptor.getValue(); assertThat(authenticationProvider.isExcludeCredential()).isFalse(); assertThat(authenticationProvider.isForcePrincipalAsString()).isFalse(); assertThat(authenticationProvider.getUserDetails()).isExactlyInstanceOf(SimpleSAMLUserDetailsService.class); }
Example 9
Source Project: spring-boot-security-saml Source File: AuthenticationProviderConfigurer.java License: MIT License | 4 votes |
@Override public void init(ServiceProviderBuilder builder) throws Exception { authenticationProviderBean = builder.getSharedObject(SAMLAuthenticationProvider.class); config = builder.getSharedObject(SAMLSSOProperties.class).getAuthenticationProvider(); }
Example 10
Source Project: spring-boot-security-saml Source File: AuthenticationProviderConfigurer.java License: MIT License | 2 votes |
/** * Provide the provider to be used. * * @param provider the {@link SAMLAuthenticationProvider} to be used. */ public AuthenticationProviderConfigurer(SAMLAuthenticationProvider provider) { authenticationProvider = provider; }