In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the failure of the SpringSecurity jump page how to do, the article is very detailed, has a certain reference value, interested friends must read it!
Today's new SpringBoot project training, for the first time added Spring Security. After successfully starting the project, I found that it was a little different from the newly built project. No matter how I set up the home page of the system, what opened in the browser was the login interface.
No matter how I set the jump path of controller, it doesn't work. I'm so angry that I scratch my head!
After consulting all kinds of data, we found that it may be the cause of Spring Security access control, so we began to configure the control rights.
Create a new SecurityConfig class to configure permissions. The code is as follows:
Import org.springframework.context.annotation.Bean;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;import org.springframework.security.crypto.password.NoOpPasswordEncoder @ EnableWebSecuritypublic class SecurityConfig extends WebSecurityConfigurerAdapter {@ Override protected void configure (HttpSecurity http) throws Exception {/ / configuration resource file, where / css/** and index can access http .authorizeRequests () .antMatrices ("/ css/**", "/ index"). PermitAll ();}}
Some explanations:
AuthorizeRequests: configure permission authentication antMatchers for some resources or links: configure which resources or links need to be authenticated permitAll: set resources or links that are fully allowed to access
After adding the above permission settings, the index page can be accessed normally.
The above is all the contents of the article "what to do if the SpringSecurity Jump Page fails". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.