public class ServiceProviderConfigurerAdapter extends Object implements ServiceProviderConfigurer
ServiceProviderConfigurer to be used in conjunction with EnableSAMLSSO and
wanting to further customize the SAML Service Provider using the DSL provided by ServiceProviderBuilder, which exposes most aspects of configuring Spring Security SAML. Users of this
interface are encouraged to use ServiceProviderConfigurerAdapter which is the default implementation with
empty methods, so users can choose which method to actually override.
The following is a basic example:
@Configuration
public static class MyServiceProviderConfig extends ServiceProviderConfigurerAdapter {
@Override
public void configure(ServiceProviderSecurityBuilder serviceProvider) throws Exception {
serviceProvider
.metadataGenerator()
.entityId("localhost-demo")
.and()
.sso()
.defaultSuccessURL("/home")
.idpSelectionPageUrl("/idpselection")
.and()
.logout()
.defaultTargetUrl("/")
.and()
.metadataManager()
.metadataLocations("classpath:/idp-ssocircle.xml")
.refreshCheckInterval(0)
.and()
.extendedMetadata()
.idpDiscoveryEnabled(true)
.and()
.keyManager()
.privateKeyDerLocation("classpath:/localhost.key.der")
.publicKeyPemLocation("classpath:/localhost.cert");
}
}
ServiceProviderConfigurerAdapter,
ServiceProviderBuilder,
EnableSAMLSSO| Constructor and Description |
|---|
ServiceProviderConfigurerAdapter() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
Allows for customization of the
HttpSecurity object exposed by WebSecurityConfigurerAdapter. |
void |
configure(ServiceProviderBuilder serviceProvider)
Allows for customization the SAML Service Provider.
|
void |
configure(org.springframework.security.config.annotation.web.builders.WebSecurity web)
Allows for customization of the
WebSecurity object exposed by WebSecurityConfigurerAdapter. |
public void configure(ServiceProviderBuilder serviceProvider) throws Exception
serviceProvider argument exposes a bunch
of configurers with options to fully customize Spring Security SAML through a DSL-like configuration.
A different method of configuration exists through configuration properties exposed by SAMLSSOProperties.configure in interface ServiceProviderConfigurerException - Any exception coming from WebSecurityConfigurerAdapter.SAMLSSOPropertiespublic void configure(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
throws Exception
HttpSecurity object exposed by WebSecurityConfigurerAdapter.configure in interface ServiceProviderConfigurerhttp - the HttpSecurity object.Exception - Any exception coming from WebSecurityConfigurerAdapter.public void configure(org.springframework.security.config.annotation.web.builders.WebSecurity web)
WebSecurity object exposed by WebSecurityConfigurerAdapter.configure in interface ServiceProviderConfigurerweb - the WebSecurity object.Copyright © 2018. All rights reserved.