Spring Boot与Spring Security整合后post数据不了,403拒绝访问 20C

直接403不能请求 大佬们求解决 急急急 按照网上说的方法解决不了啊 求大神解决

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Spring Boot与Spring Security整合后无法上传图片403
查阅资料发现:Spring Boot与Spring Security整合后,不仅仅只是无法上传图片,只要是post请求,就会出现403拒绝访问   首先:403错误,表示资源不可用。服务器理解客户的请求,但拒绝处理它,通常由于服务器上文件或目录的权限设置导致的WEB访问错误。 了解了错误后,大概就是我用户权限不够吧。当我登录以后,以admin权限去操作post还是一样的错误。 于是去c...
spring boot,mybaits,spring security,redis整合
spring boot,mybaits,spring security,redis整合
spring boot、 mybaits、 spring security、 redis整合
spring boot、 mybaits、 spring security、 redis整合
Spring Boot 使用 Spring Security 后无法 POST 提交数据解决方法
【问题描述】 项目使用的是 spring-boot + spring-security,页面用了 thymeleaf 模板 页面代码如下: username: password: Submit 登录操作代码: /** * 登录操作; * * @param userName 用户名; * @param password 密码;
spring boot +spring security 4 报type=Forbidden, status=403
访问 resource/templates/login.html 报type=Forbidden, status=403rn[code=java]rn@SpringBootApplicationrnpublic class MainApplication extends WebMvcConfigurerAdapter rn public static void main(String[] args) rn //SpringApplication.run(MainApplication.class, args);rn SpringApplication app=new SpringApplication(MainApplication.class); rn Appctx.ctx=app.run(args);rn@Overridern public void addViewControllers(ViewControllerRegistry registry) rn registry.addViewController("/login").setViewName("login");rn registry.addViewController("/").setViewName("login");rn super.addViewControllers(registry);rn rn[/code]rnrn[code=java]rnpublic class WebSecurityConfig extends WebSecurityConfigurerAdapter rn @Autowiredrn private CustomUserDetailsService customUserDetailsService;//code1rnrn @Overridern protected void configure(HttpSecurity http) throws Exception rn //允许所有用户访问”/”和”/home”rn httprn .csrf().disable()rn .authorizeRequests().antMatchers("/", "/home").permitAll()rn //其他地址的访问均需验证权限rn .anyRequest().authenticated()rn .and()rn .formLogin()rn //指定登录页是”/login”rn .loginPage("/login")rn //.usernameParameter("TEST").passwordParameter("123456") rn .permitAll()rn //登录成功后可使用loginSuccessHandler()存储用户信息,可选。rn .successHandler(loginSuccessHandler())//code3rn .and()rn .logout()rn //退出登录后的默认网址是”/home”rn .logoutSuccessUrl("/home")rn .permitAll()rn .invalidateHttpSession(true)rn .and()rn //登录后记住用户,下次自动登录rn //数据库中必须存在名为persistent_logins的表rn //建表语句见code15rn .rememberMe()rn .tokenValiditySeconds(1209600);rn rn rn rnrn @Autowiredrn public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception rn //auth.inMemoryAuthentication().withUser("TEST").password("123456").roles("ADMIN");rn auth.userDetailsService(customUserDetailsService).passwordEncoder(passwordEncoder());//code5rn auth.eraseCredentials(false); rn rnrn[/code]
Spring Boot Security example
Spring Boot Security example 内容来源于下面网站 https://www.cnblogs.com/cjsblog/p/9152455.html
spring boot security 项目
spring boot security 项目spring boot security 项目spring boot security 项目spring boot security 项目
spring boot jpa security
#boot-jpa-security-dmdb-freemark spring boot spring security 达梦数据库 ftl assembly 打包
Spring Boot + Security
SpringBoot集成Security,基于内存实现用户权限控制,各个配置都有注释
spring security cas单点登录拒绝访问
[b]cas服务端和cas客户端都已经配合,访问cas服务端可以登录,访问客户端应用资源的时候出现拒绝访问问题,但是[color=red]能成功跳转到cas服务端的login页面,输入账号密码后控制台打印显示出服务端登录成功,但是关于客户端的打印出现拒绝访问异常,而且httpSession不为null但是里面没值[/color][/b]。rnrn初次使用spring security和cas望多多指教.rn异常信息:rn[color=red][b]首次登录直接出现拒绝访问,但是却能跳转到cas 登录页面,[/b][/color]rn[quote]rn信息: Server startup in 21955 msrn2012-6-6 11:51:31 org.apache.catalina.core.ApplicationContext logrn信息: HTMLManager: init: Associated with Deployer 'Catalina:type=Deployer,host=localhost'rn2012-6-6 11:51:31 org.apache.catalina.core.ApplicationContext logrn信息: HTMLManager: init: Global resources are availablern2012-6-6 11:51:31 org.apache.catalina.core.ApplicationContext logrn信息: HTMLManager: list: Listing contexts for virtual host 'localhost'rn2012-06-06 11:51:32,593 INFO [org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner] - rn2012-06-06 11:51:32,593 INFO [org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner] - <0 tickets found to be removed.>rn2012-06-06 11:51:32,593 INFO [org.jasig.cas.ticket.registry.support.DefaultTicketRegistryCleaner] - rn11:51:33,906 DEBUG org.springframework.security.web.FilterChainProxy:318 - /index.jsp at position 1 of 12 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'rn11:51:33,921 DEBUG org.springframework.security.web.context.HttpSessionSecurityContextRepository:127 - No HttpSession currently existsrn11:51:33,921 DEBUG org.springframework.security.web.context.HttpSessionSecurityContextRepository:85 - No SecurityContext was available from the HttpSession: null. A new one will be created.rn11:51:33,921 DEBUG org.springframework.security.web.FilterChainProxy:318 - /index.jsp at position 2 of 12 in additional filter chain; firing Filter: 'LogoutFilter'rn11:51:33,921 DEBUG org.springframework.security.web.FilterChainProxy:318 - /index.jsp at position 3 of 12 in additional filter chain; firing Filter: 'CasAuthenticationFilter'rn11:51:33,937 DEBUG org.springframework.security.cas.web.CasAuthenticationFilter:311 - serviceTicketRequest = falsern11:51:33,937 DEBUG org.springframework.security.cas.web.CasAuthenticationFilter:362 - proxyReceptorConfigured = falsern11:51:33,937 DEBUG org.springframework.security.cas.web.CasAuthenticationFilter:349 - proxyReceptorRequest = falsern11:51:33,937 DEBUG org.springframework.security.cas.web.CasAuthenticationFilter:327 - proxyTicketRequest = falsern11:51:33,937 DEBUG org.springframework.security.cas.web.CasAuthenticationFilter:262 - requiresAuthentication = falsern11:51:33,937 DEBUG org.springframework.security.web.FilterChainProxy:318 - /index.jsp at position 4 of 12 in additional filter chain; firing Filter: 'UsernamePasswordAuthenticationFilter'rn11:51:33,937 DEBUG org.springframework.security.web.FilterChainProxy:318 - /index.jsp at position 5 of 12 in additional filter chain; firing Filter: 'DefaultLoginPageGeneratingFilter'rn11:51:33,937 DEBUG org.springframework.security.web.FilterChainProxy:318 - /index.jsp at position 6 of 12 in additional filter chain; firing Filter: 'BasicAuthenticationFilter'rn11:51:33,937 DEBUG org.springframework.security.web.FilterChainProxy:318 - /index.jsp at position 7 of 12 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'rn11:51:33,937 DEBUG org.springframework.security.web.FilterChainProxy:318 - /index.jsp at position 8 of 12 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'rn11:51:33,937 DEBUG org.springframework.security.web.FilterChainProxy:318 - /index.jsp at position 9 of 12 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'rn11:51:33,937 DEBUG org.springframework.security.web.authentication.AnonymousAuthenticationFilter:102 - Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@9055e4a6: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS'rn11:51:33,937 DEBUG org.springframework.security.web.FilterChainProxy:318 - /index.jsp at position 10 of 12 in additional filter chain; firing Filter: 'SessionManagementFilter'rn11:51:33,937 DEBUG org.springframework.security.web.session.SessionManagementFilter:91 - Requested session IDFED78FFF2BDBC0647461CBFA29AB9B23 is invalid.rn11:51:33,937 DEBUG org.springframework.security.web.FilterChainProxy:318 - /index.jsp at position 11 of 12 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'rn11:51:33,937 DEBUG org.springframework.security.web.FilterChainProxy:318 - /index.jsp at position 12 of 12 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'rn11:51:33,937 DEBUG org.springframework.security.web.access.intercept.FilterSecurityInterceptor:193 - Secure object: FilterInvocation: URL: /index.jsp; Attributes: [ROLE_USER]rn11:51:33,937 DEBUG org.springframework.security.web.access.intercept.FilterSecurityInterceptor:298 - Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@9055e4a6: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@957e: RemoteIpAddress: 127.0.0.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUSrn11:51:33,937 DEBUG org.springframework.security.access.vote.AffirmativeBased:65 - Voter: org.springframework.security.access.vote.RoleVoter@13e02ed, returned: -1rn11:51:33,953 DEBUG org.springframework.security.access.vote.AffirmativeBased:65 - Voter: org.springframework.security.access.vote.AuthenticatedVoter@322394, returned: 0rn11:51:33,968 DEBUG org.springframework.security.web.access.ExceptionTranslationFilter:165 - Access is denied (user is anonymous); redirecting to authentication entry pointrnorg.springframework.security.access.AccessDeniedException: Access is deniedrn at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:83)rn at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:205)rn at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:114)rn at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:91)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)rn at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)rn at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)rn at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)rn at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)rn at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)rn at java.lang.Thread.run(Thread.java:662)rn11:51:33,984 DEBUG org.springframework.security.web.savedrequest.HttpSessionRequestCache:41 - DefaultSavedRequest added to Session: DefaultSavedRequest[http://localhost:8080/Cas_Client/]rn11:51:33,984 DEBUG org.springframework.security.web.access.ExceptionTranslationFilter:185 - Calling Authentication entry point.rn11:51:33,984 DEBUG org.springframework.security.web.context.HttpSessionSecurityContextRepository:269 - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.rn11:51:34,015 DEBUG org.springframework.security.web.context.SecurityContextPersistenceFilter:97 - SecurityContextHolder now cleared, as request processing completedrn2012-06-06 11:51:34,921 INFO [org.jasig.cas.web.flow.InitialFlowSetupAction] - rnrn[/quote]rnrnrn[color=red][b]跳转到登录页面后输入账号密码出现cas服务端的信息正常,但是关于cas客户端的和上面的异常一样:[/b][/color]rn打印信息:rn[quote]rn2012-06-06 12:03:21,625 INFO [org.jasig.cas.services.DefaultServicesManagerImpl] - rn2012-06-06 12:03:21,625 INFO [org.jasig.cas.services.DefaultServicesManagerImpl] - rnstart[1338955402531] time[603] tag[QueryDatabaseAuthenticationHandler]rn2012-06-06 12:03:23,125 INFO [org.jasig.cas.authentication.AuthenticationManagerImpl] - rn2012-06-06 12:03:23,234 INFO [org.jasig.cas.authentication.AuthenticationManagerImpl] - rn2012-06-06 12:03:23,234 INFO [org.jasig.cas.authentication.AuthenticationManagerImpl] - rn2012-06-06 12:03:23,250 INFO [com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - rn2012-06-06 12:03:23,250 INFO [com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - rn2012-06-06 12:03:23,265 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - rn2012-06-06 12:03:23,265 INFO [com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - rn12:03:23,296 DEBUG org.springframework.security.web.FilterChainProxy:318 - /j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer at position 1 of 12 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'rn12:03:23,296 DEBUG org.springframework.security.web.context.HttpSessionSecurityContextRepository:139 - HttpSession returned null object for SPRING_SECURITY_CONTEXTrn12:03:23,296 DEBUG org.springframework.security.web.context.HttpSessionSecurityContextRepository:85 - No SecurityContext was available from the HttpSession: org.apache.catalina.session.StandardSessionFacade@1ef3d12. A new one will be created.rn12:03:23,296 DEBUG org.springframework.security.web.FilterChainProxy:318 - /j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer at position 2 of 12 in additional filter chain; firing Filter: 'LogoutFilter'rn12:03:23,296 DEBUG org.springframework.security.web.FilterChainProxy:318 - /j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer at position 3 of 12 in additional filter chain; firing Filter: 'CasAuthenticationFilter'rn12:03:23,296 DEBUG org.springframework.security.cas.web.CasAuthenticationFilter:311 - serviceTicketRequest = falsern12:03:23,296 DEBUG org.springframework.security.cas.web.CasAuthenticationFilter:362 - proxyReceptorConfigured = falsern12:03:23,296 DEBUG org.springframework.security.cas.web.CasAuthenticationFilter:349 - proxyReceptorRequest = falsern12:03:23,296 DEBUG org.springframework.security.cas.web.CasAuthenticationFilter:327 - proxyTicketRequest = falsern12:03:23,296 DEBUG org.springframework.security.cas.web.CasAuthenticationFilter:262 - requiresAuthentication = falsern12:03:23,296 DEBUG org.springframework.security.web.FilterChainProxy:318 - /j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer at position 4 of 12 in additional filter chain; firing Filter: 'UsernamePasswordAuthenticationFilter'rn12:03:23,296 DEBUG org.springframework.security.web.FilterChainProxy:318 - /j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer at position 5 of 12 in additional filter chain; firing Filter: 'DefaultLoginPageGeneratingFilter'rn12:03:23,296 DEBUG org.springframework.security.web.FilterChainProxy:318 - /j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer at position 6 of 12 in additional filter chain; firing Filter: 'BasicAuthenticationFilter'rn12:03:23,296 DEBUG org.springframework.security.web.FilterChainProxy:318 - /j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer at position 7 of 12 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'rn12:03:23,296 DEBUG org.springframework.security.web.savedrequest.DefaultSavedRequest:309 - pathInfo: both null (property equals)rn12:03:23,296 DEBUG org.springframework.security.web.savedrequest.DefaultSavedRequest:317 - queryString: arg1=null; arg2=ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer (property not equals)rn12:03:23,296 DEBUG org.springframework.security.web.savedrequest.HttpSessionRequestCache:75 - saved request doesn't matchrn12:03:23,296 DEBUG org.springframework.security.web.FilterChainProxy:318 - /j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer at position 8 of 12 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'rn12:03:23,296 DEBUG org.springframework.security.web.FilterChainProxy:318 - /j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer at position 9 of 12 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'rn12:03:23,296 DEBUG org.springframework.security.web.authentication.AnonymousAuthenticationFilter:102 - Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@6fa86552: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@fffd148a: RemoteIpAddress: 127.0.0.1; SessionId: 659060E504E41E2F28CF873803A07F81; Granted Authorities: ROLE_ANONYMOUS'rn12:03:23,312 DEBUG org.springframework.security.web.FilterChainProxy:318 - /j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer at position 10 of 12 in additional filter chain; firing Filter: 'SessionManagementFilter'rn12:03:23,312 DEBUG org.springframework.security.web.FilterChainProxy:318 - /j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer at position 11 of 12 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'rn12:03:23,312 DEBUG org.springframework.security.web.FilterChainProxy:318 - /j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer at position 12 of 12 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'rn12:03:23,312 DEBUG org.springframework.security.web.access.intercept.FilterSecurityInterceptor:193 - Secure object: FilterInvocation: URL: /j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer; Attributes: [ROLE_USER]rn12:03:23,312 DEBUG org.springframework.security.web.access.intercept.FilterSecurityInterceptor:298 - Previously Authenticated: org.springframework.security.authentication.AnonymousAuthenticationToken@6fa86552: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@fffd148a: RemoteIpAddress: 127.0.0.1; SessionId: 659060E504E41E2F28CF873803A07F81; Granted Authorities: ROLE_ANONYMOUSrn12:03:23,312 DEBUG org.springframework.security.access.vote.AffirmativeBased:65 - Voter: org.springframework.security.access.vote.RoleVoter@13e02ed, returned: -1rn12:03:23,312 DEBUG org.springframework.security.access.vote.AffirmativeBased:65 - Voter: org.springframework.security.access.vote.AuthenticatedVoter@322394, returned: 0rn12:03:23,312 DEBUG org.springframework.security.web.access.ExceptionTranslationFilter:165 - Access is denied (user is anonymous); redirecting to authentication entry pointrnorg.springframework.security.access.AccessDeniedException: Access is deniedrn at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:83)rn at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:205)rn at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:114)rn at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:101)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:91)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:182)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)rn at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)rn at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)rn at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)rn at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)rn at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)rn at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)rn at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)rn at java.lang.Thread.run(Thread.java:662)rn12:03:23,312 DEBUG org.springframework.security.web.savedrequest.HttpSessionRequestCache:41 - DefaultSavedRequest added to Session: DefaultSavedRequest[http://localhost:8080/Cas_Client/j_acegi_cas_security_check?ticket=ST-1-eOK4CG7zd7cApkahlva9-casServer]rn12:03:23,312 DEBUG org.springframework.security.web.access.ExceptionTranslationFilter:185 - Calling Authentication entry point.rn12:03:23,312 DEBUG org.springframework.security.web.context.HttpSessionSecurityContextRepository:269 - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.rn12:03:23,343 DEBUG org.springframework.security.web.context.SecurityContextPersistenceFilter:97 - SecurityContextHolder now cleared, as request processing completedrnrn[/quote]rnrn[b]cas服务端配置:[/b]rncas.propertiesrn[quote]rn#server.prefix=http://localhost:8080/casrn#server.prefix=http://cas.wucht.com:8080/casServerrnserver.prefix=http://localhost:8080/casServerrnrnrncas.securityContext.serviceProperties.service=$server.prefix/j_acegi_cas_security_checkrn# Names of roles allowed to access the CAS service managerrncas.securityContext.serviceProperties.adminRoles=ROLE_ADMINrncas.securityContext.casProcessingFilterEntryPoint.loginUrl=$server.prefix/loginrncas.securityContext.ticketValidator.casServerUrlPrefix=$server.prefixrnrnrncas.themeResolver.defaultThemeName=cas-theme-defaultrn#cas.themeResolver.defaultThemeName=defaultrncas.viewResolver.basename=default_viewsrnrn#host.name=casrnhost.name=casServerrnrn#database.hibernate.dialect=org.hibernate.dialect.OracleDialectrndatabase.hibernate.dialect=org.hibernate.dialect.MySQLDialectrn#database.hibernate.dialect=org.hibernate.dialect.HSQLDialectrnrn[/quote]rnrnrndeployerConfigContext.xmlrn[quote]rnrnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn rn rn rn rn rn rnrn rnrn rn rn rn rn rn rn rn rnrnrn rn rn com.mysql.jdbc.Driverrn jdbc:mysql://localhost:3306/mysql?useUnicode=true&characterEncoding=utf-8rn rootrn rootrn rnrn rn rnrn rn rn rn rn rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rnrnrn[/quote]rnrn[b]spring的配置代码如下:[/b][code="ruby"]rnrnrnrn rn rn rn rnrn rn rn rn rn rn rnrn rn rn rnrn rn rn rn rn rnrnrn rn rn rn rn rnrn rn rn rnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrn rnrnrnrn rn rn rn rn authoritiesrn rn rn rnrnrn rnrnrnrn rnrnrnrnrnrnrnrnrn rn rnrnrnrnrn rn rnrn rn rn rn rn rn rn rn rn rnrn rn rn rnrn[/code]
spring security oauth2整合
spring security oauth2整合的详细说明文档,demo下载地址在文档中已经给出。其中demo中包含了详细的代码注释。
spring Security整合SSH
Spring Security与SSH整合,Spring Security通过数据库给用户认证授权,且jar完整,除了简单配置数据库,即可运行!
spring security整合ext
最近在学习spring security,在与ext整合的过程中,我想在前台获取已登录用户所可以访问的资源,但是使用spring security的SPRING_SECURITY_RESOURCES获取一直返回是null,刚开始学习ss,也不知道是不是重写方法的时候写错了,求高手指点rnrn下面是一些我自己定义的方法以及重写的接口方法rn[code=java]rn//------------------------以下Spring Security 3 使用------------------------//rn /**rn * 自定义方法,这个类放入到Spring容器后,指定init为初始化方法,从数据库中读取资源 rn */rn @Overridern public void init() rn System.out.println("加载资源...");rn resourceMap = new HashMap>();rn List resourceList = systemSourceDao.findAll();rn // 通过数据库中的信息设置,systemSource和rolern for (SystemSource resource : resourceList) rn //添加到resourceMap,键:资源内容(url),值:角色名(如ROLE_XXXX)rn resourceMap.put(resource.getResourceContent(), setToCollection(resource.getRoles()));rn System.out.println("加载资源:【"+resource.getResourceContent()+"】");rn for (Role role : resource.getRoles()) rn System.out.println("----加载拥有该资源的角色:"+role.getId()+","+role.getRoleName()+","+role.getDescription());rn rn rn rn rnrn /**rn * 自定义方法,将Set集合转换为框架需要的Collection集合rn */rn @Overridern public Collection setToCollection(Set roles) rn List list = new ArrayList();rn //添加角色名(ROLE_XXXX)到列表rn for (Role role : roles) rn //SecurityConfig实现了ConfigAttribute接口rn list.add(new SecurityConfig(role.getDescription()));rn rn rn return list;rn rnrn /**rn * 接口方法rn * 获取所有权限配置属性rn */rn @Overridern public Collection getAllConfigAttributes() rn //实际上是存放所有角色名称(如:ROLE_XXXX)rn Set allAttributes = new HashSet();rn //resourceMap.entrySet()返回Set>,即所有键的集合rn for (Map.Entry> entry : resourceMap.entrySet()) rn allAttributes.addAll(entry.getValue());rn rn rn return allAttributes;rn rnrn /**rn * 接口方法rn * 用户获取正在访问的资源与所拥有的权限做对比rn */rn @Overridern public Collection getAttributes(Object object) rn return null;rn rnrn /**rn *接口方法rn * 必须返回truern **/rn @Overridern public boolean supports(Class clazz) rn // TODO Auto-generated method stubrn return true;rn rn[/code]
spring hibernate security整合
spring hibernate security整合
Spring和Security整合详解
Spring和Security整合详解 官方主页 Spring Security 概述 Spring 是一个非常流行和成功的 Java 应用开发框架。Spring Security 基于 Spring 框架,提供了一套 Web 应用安全性的完整解决方案。一般来说,Web 应用的安全性包括用户认证(Authentication)和用户授权(Authorization)两个部分。用户认证指的是验证某个...
spring boot整合spring security自定义登录跳转地址
说明 在博客用户登录后我想跳转到各自用户的博客首页,我们知道这个地址是动态的。 例如: http://localhost:8080/blog/zhangsan, 每个用户地址不一样。这时候我就用到了自定义登录成功处理器,当然还有失败处理器,大家可以研究研究。 实现效果 1.访问受保护资源 访问:localhost:8080/welcome后跳转到登录页,登录成功后跳转到welco...
关于spring boot + spring security + spring boot 结合搭框架
来了一家新公司,然后用的是以spring boot + spring security + spring boot + auth2 为主搭的框架,然后公司让我去学习这种框架,前辈也给了关于此框架的官网地址,我在官网下了代码,发现基本是属于0配置的项目,然后有以下困惑rn1 不知道框架是通过什么配置并组装的rn2 请求和处理请求是怎么关联的rnrn想问问各路大神,我应该如何上手,以及能否推荐一点资料
spring boot 整合 spring security 之使用数据库验证
spring boot 整合 spring security 参见上一篇文章.重写WebSecurityConfigurerAdapter中的configureGlobal方法@Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.authenticat
在Spring Boot中整合Spring Security并自定义验证代码
最终效果 1、实现页面访问权限限制 2、用户角色区分,并按照角色区分页面权限 3、实现在数据库中存储用户信息以及角色信息 4、自定义验证代码
spring security spring security
spring security spring security 中文文档
Spring Boot学习笔记(四)—— 使用Spring Security
一、前言 Spring Boot同样提供了关于Spring Security的自动配置支持,在org.springframework.boot.autoconfigure.security包中可以看到,在SpringBootWebSecurityConfiguration中,为我们自动配置了: 一个内存中的用户user,密码在程序启动时出现; 忽略对静态文件的拦截, private
Spring Boot集成Spring Security Demo
Spring Boot集成Spring Security 的示例:1.包括自定义认证规则,从数据库获取用户,权限,角色。2.如何在html中使用sec标签。参考博客:https://mp.csdn.net/mdeditor/80780269
全注解 spring boot +spring security + mybatis+druid+thymeleaf+jsp+mysql+bootstrap
全注解 spring boot +spring security + mybatis+druid+thymeleaf+jsp+mysql+bootstrap 支持thymeleaf和jsp并存 全注解 spring boot spring security thymeleaf+jsp同时使用 mybatis druid mysql bootstrap 访问 thymeleaf:http://127.0.0.1:8080/index jsp:http://127.0.0.1:8080/helloJsp druid:http://127.0.0.1:8080/druid 管理员 admin/admin 普通用户user/user
Spring Security spring boot 前后端分离问题
前后台分离架构,rn登录认证通过访问其他URL还是跳转登录页,就是说登录没起作用。认证没通过rn[img=https://img-bbs.csdn.net/upload/201806/15/1529054023_476092.png][/img]rn自定义登录认证rn用户名和密码都是死的,没查数据库,直接通过。rn[img=https://img-bbs.csdn.net/upload/201806/15/1529054060_513123.png][/img]rn不知道问题出在哪了。rn前端访问的时候控制台报错跨域问题rn[img=https://img-bbs.csdn.net/upload/201806/15/1529054264_839648.png][/img]rn后台已经加上跨域问题rn[img=https://img-bbs.csdn.net/upload/201806/15/1529054241_49274.png][/img]rnrn各种找资料还是没有解决,有经验的大神给指导下。
全注解 spring boot +spring security + mybatis+druid+thymeleaf+mysql+bootstrap
全注解 spring boot +spring security + thymeleaf+mybatis+druid+mysql+bootstrap 框架。 带数据库脚本和说明文件
Spring boot + Spring Security 简单配置实例
Spring boot + Spring Security 简单配置,数据库采用MongoDB
Spring Boot集成Spring Security的Demo
本文介绍了在spring boot如何使用spring security,spring security的基本配置。如何实现自定义登录,自定义登录成功处理,自定义登录失败处理。
Spring Boot 启动不了
An attempt was made to call the method org.apache.coyote.AbstractProtocol.setAcceptCount(I)V but it does not exist. Its class, org.apache.coyote.AbstractProtocol, is available from the following locat...
spring boot 整合 elasticsearch
spring boot 整合 elasticsearch 实现按照属性查询 spring boot 整合 elasticsearch 实现按照ID查询 注意查看README.MD文件
spring boot整合mongodb
该压缩文件为spring boot整合mongodb的demo工程,兼容所有版本的mongodb,亲测可用。
spring boot和mybatis整合
一个简单的spring boot 和mybatis整合的实例,spring boot 就是spring 与 spring mvc的综合 mybatis就是半自动的orm框架,这是一个简单的整合demo
Spring Boot -- 整合Websocket
spring boot整合websocket, 通过http请求给websocket server给websocket client发送消息.实现消息推送和网页聊天功能.
spring boot 整合mybatis+MySQL+freemaker+druid
spring boot 整合mybatis+MySQL+freemaker+druid,正常查询,页面渲染,可以供新手参考,不知道哪里设置下载积分,默认5积分,怪不好意思的。
spring boot整合demo
springboot与shiro,thymeleaf,mybatis整合的一个demo,适合小型项目的快速开发与学习
spring boot整合finereport
包含的文档中,讲解了如何进行finereport和spring boot的整合,包含需要用的jar包,已经整合成功
Spring Boot 整合多数据源
Spring Boot 整合多数据源 我们先创建一个maven项目: 创建两个数据库test01和test02,并且都创建一个user表 配置pom.xml project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:sch
Spring Boot整合Redis缓存
Spring Boot是现在很热门的一个微服务框架,作为一名Java Web 开发工程师,是必须要掌握它的。本系列课程会一步一步教大家如何使用Spring Boot,以及Spring Boot如何整合其它技术。
spring boot整合mybatis
这个项目前面的章节简单介绍了idea的使用,vue的入门,Spring Boot的应用开发入门。nnn后面开发了一个通用的后台管理系统。技术上使用Spring Boot框架整合ssm,数据库使用MySQL,使用整合了druid数据库连接池。使用了quartz开发自定义定时任务。使用了AOP开发日志系统。使用shiro开发权限功能。使用BootStrap搭建前端页面,Vue做前端交互。
Spring boot整合Dubbo
1、Spring Boot 她其实就是整合了Spring MVC和Spring减少了配置的xml用注解和application.properties代替了.xml,其次他还内嵌可tomcat可以用Main函数替代了tomcat。 2、Dubbo又阿里开发的典型的分布式处理框架 ,其中分为:消费者(Consumer),生产者(Provider),注册中心(Registry),这个注册中心使用的是zookeeper,服务监控中心(Monitor)统计服务的调用次数和调用时间的日志服务称之为“服务监控中心”。如图是Dubbo的运行原理。
Spring Boot整合Mybatis
Spring Boot整合MyBatis实现Restfull API实例,具体原理请参考笔者专栏Spring Boot从入门到精通
相关热词 c#部署端口监听项目、 c#接口中的属性使用方法 c# 昨天 c#func链接匿名方法 c#怎么创建文件夹 c#从键盘接收空格 c#da/ad c#部门请假管理系统 c#服务器socket c# 默认的访问修饰符