【发布时间】:2014-02-22 21:22:05
【问题描述】:
此文本在本地运行时直接来自我的控制台记录器。第二行紧跟第一行。我不确定提供访问被拒绝异常的幕后发生了什么。
2014-01-30 07:48:14.854 INFO 5452 --- [nio-8085-exec-3] o.s.b.a.audit.listener.AuditListener : AuditEvent [timestamp=Thu Jan 30 07:48:14 CST 2014, principal=r2n, type=AUTHENTICATION_SUCCESS, data={details=org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: 2C7EC273522BB6880EE3410201F8A41F}]
2014-01-30 07:48:14.859 INFO 5452 --- [nio-8085-exec-4] o.s.b.a.audit.listener.AuditListener : AuditEvent [timestamp=Thu Jan 30 07:48:14 CST 2014, principal=r2n, type=AUTHORIZATION_FAILURE, data={message=Access is denied, type=org.springframework.security.access.AccessDeniedException}]
我的代码是使用 Spring Boot 版本 1.0.0.RC1、Spring Security 3.1.0.Release 和用于 spring 2.1.1.Release 的 thymeleaf 编译的。我知道由于 Spring Boot 使用 Spring 4,因此 Spring 3 的基础 Spring 依赖项和 thymeleaf 存在一些冲突。
我不认为我的问题在于他们。
这是来自 WebSecurityConfiguration 扩展 WebSecurityConfigurerAdapter 的代码。我的身份验证是使用 ldap。
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/error").anonymous()
.antMatchers("/navigation").anonymous()
.antMatchers("/**").hasRole("ADMIN") // #4
.and()
.formLogin()
.permitAll()
.defaultSuccessUrl("/")
.and()
.csrf().disable();
}
【问题讨论】:
标签: spring-security spring-ldap spring-boot