Fix SAML 2.0 Javaconfig Sample

Issue gh-9362
This commit is contained in:
Josh Cummings 2021-01-22 11:18:12 -07:00
parent 56db058fd0
commit 8533312c6b
No known key found for this signature in database
GPG Key ID: 49EF60DD7FF83443
4 changed files with 19 additions and 3 deletions

View File

@ -3,6 +3,7 @@ apply plugin: 'io.spring.convention.spring-sample-war'
dependencies {
compile project(':spring-security-saml2-service-provider')
compile project(':spring-security-config')
compile slf4jDependencies
testCompile 'org.springframework:spring-test'
}

View File

@ -28,6 +28,10 @@ import org.springframework.security.web.session.HttpSessionEventPublisher;
public class MessageSecurityWebApplicationInitializer extends
AbstractSecurityWebApplicationInitializer {
public MessageSecurityWebApplicationInitializer() {
super(SecurityConfig.class);
}
@Override
protected boolean enableHttpSessionEventPublisher() {
return true;

View File

@ -21,6 +21,7 @@ import java.security.cert.X509Certificate;
import org.opensaml.security.x509.X509Support;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.Customizer;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@ -52,9 +53,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.authorizeRequests((authz) -> authz
.anyRequest().authenticated()
)
.saml2Login((saml2) -> saml2
.loginProcessingUrl("/sample/jc/saml2/sso/{registrationId}")
);
.saml2Login(Customizer.withDefaults());
// @formatter:on
}

View File

@ -0,0 +1,12 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="WARN">
<appender-ref ref="STDOUT" />
</root>
</configuration>