我想,以确保其正在使用的Spring Security(v3.0.3)Tomcat服务器服务的接入HTML文件我有一个磁头从开始这个线程
在这个版本春天的资源标记为不可用:我不使用MVC。
这里是我的配置
弹簧security.xml文件
<security:http auto-config="true" use-expressions="true">
<security:intercept-url pattern="**/admin.html" access="hasRole('ROLE_ADMIN')/>
<security:intercept-url pattern="/**" access="hasAnyRole('ROLE_USER','ROLE_ADMIN')" />
<security:http-basic />
</security:http>
<security:authentication-manager>
<security:authentication-provider>
<security:user-service>
<security:user name="ved" password="12345" authorities="ROLE_USER" />
<security:user name="admin" password="admin" authorities="ROLE_ADMIN" />
</security:user-service>
</security:authentication-provider>
</security:authentication-manager>
调试
09:59:39,873 DEBUG FilterChainProxy:175 - Converted URL to lowercase, from: '/app/views/admin.html'; to: '/app/views/admin.html'
09:59:39,874 DEBUG FilterChainProxy:182 - Candidate is: '/app/views/admin.html'; pattern is /**; matched=true
09:59:39,874 DEBUG FilterChainProxy:350 - /app/views/admin.html at position 1 of 11 in additional filter chain; firing Filter: 'org.springframework.security.web.context.SecurityContextPersistenceFilter@1670cc6'
09:59:39,874 DEBUG HttpSessionSecurityContextRepository:165 - Obtained a valid SecurityContext from SPRING_SECURITY_CONTEXT: 'org.springframework.security.core.context.SecurityContextImpl@b92b6f9e: Authentication: org.springframework.security.authentication.UsernamePasswordAuthenticationToken@b92b6f9e: Principal: org.springframework.security.core.userdetails.User@1c795: Username: ved; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_USER; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@fffdaa08: RemoteIpAddress: 127.0.0.1; SessionId: CC43ECD3050181A4FFAB5B4897D78AEE; Granted Authorities: ROLE_USER'
09:59:39,874 DEBUG FilterChainProxy:350 - /app/views/admin.html at position 2 of 11 in additional filter chain; firing Filter: 'org.springframework.security.web.authentication.logout.LogoutFilter@1e04a35'
09:59:39,874 DEBUG FilterChainProxy:350 - /app/views/admin.html at position 3 of 11 in additional filter chain; firing Filter: 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@281902'
09:59:39,875 DEBUG FilterChainProxy:350 - /app/views/admin.html at position 4 of 11 in additional filter chain; firing Filter: 'org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@81d783'
09:59:39,875 DEBUG FilterChainProxy:350 - /app/views/admin.html at position 5 of 11 in additional filter chain; firing Filter: 'org.springframework.security.web.authentication.www.BasicAuthenticationFilter@6c01b9'
09:59:39,876 DEBUG BasicAuthenticationFilter:131 - Basic Authentication Authorization header found for user 'ved'
09:59:39,876 DEBUG FilterChainProxy:350 - /app/views/admin.html at position 6 of 11 in additional filter chain; firing Filter: 'org.springframework.security.web.savedrequest.RequestCacheAwareFilter@e5307e'
09:59:39,876 DEBUG FilterChainProxy:350 - /app/views/admin.html at position 7 of 11 in additional filter chain; firing Filter: 'org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@d2bb53'
09:59:39,876 DEBUG FilterChainProxy:350 - /app/views/admin.html at position 8 of 11 in additional filter chain; firing Filter: 'org.springframework.security.web.authentication.AnonymousAuthenticationFilter@58ff51'
09:59:39,877 DEBUG AnonymousAuthenticationFilter:72 - SecurityContextHolder not populated with anonymous token, as it already contained: 'org.springframework.security.authentication.UsernamePasswordAuthenticationToken@b92b6f9e: Principal: org.springframework.security.core.userdetails.User@1c795: Username: ved; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: ROLE_USER; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@fffdaa08: RemoteIpAddress: 127.0.0.1; SessionId: CC43ECD3050181A4FFAB5B4897D78AEE; Granted Authorities: ROLE_USER'
09:59:39,877 DEBUG FilterChainProxy:350 - /app/views/admin.html at position 9 of 11 in additional filter chain; firing Filter: 'org.springframework.security.web.session.SessionManagementFilter@e22632'
09:59:39,877 DEBUG FilterChainProxy:350 - /app/views/admin.html at position 10 of 11 in additional filter chain; firing Filter: 'org.springframework.security.web.access.ExceptionTranslationFilter@139d891'
09:59:39,877 DEBUG FilterChainProxy:350 - /app/views/admin.html at position 11 of 11 in additional filter chain; firing Filter: 'org.springframework.security.web.access.intercept.FilterSecurityInterceptor@b92dc2'
09:59:39,878 DEBUG ExpressionBasedFilterInvocationSecurityMetadataSource:173 - Converted URL to lowercase, from: '/app/views/admin.html'; to: '/app/views/admin.html'
09:59:39,878 DEBUG ExpressionBasedFilterInvocationSecurityMetadataSource:200 - Candidate is: '/app/views/admin.html'; pattern is **/admin.html; matched=false
09:59:39,878 DEBUG ExpressionBasedFilterInvocationSecurityMetadataSource:200 - Candidate is: '/app/views/admin.html'; pattern is /**; matched=true
09:59:39,879 DEBUG FilterSecurityInterceptor:191 - Secure object: FilterInvocation: URL: /app/views/admin.html; Attributes: [hasAnyRole('ROLE_USER','ROLE_ADMIN')]
我们在这里看到
09:59:39878 DEBUG ExpressionBasedFilterInvocationSecurityMetadataSource:200 - 候选是: '/app/views/admin.html'; 图案是** / admin.html; 匹配=假
管理页面仍然被送达ROLE_USER。
在固定任何帮助,这将不胜感激。