저는 많은 주제가 있다는 것을 알고 있습니다 만, json 객체로 작업하기 위해 일반적인 스프링 보안을 수정하는 방법이 있습니다.휴식을위한 스프링 부트 보안
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true) //za pre i post authorize v servisa
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter
{
//Koi service shte polzvame
@Autowired
private UserService userService;
@Override
protected void configure(HttpSecurity http) throws Exception
{
http.authorizeRequests()
.antMatchers("/", "/user/register", "/css/**", "/js/**").permitAll()
.antMatchers("/user/user").access("hasRole('USER') or hasRole('ADMIN')")
.antMatchers("/user/admin").hasRole("ADMIN")
.anyRequest().authenticated()
.and()
.formLogin().loginPage("/user/login").permitAll()
.usernameParameter("username")
.passwordParameter("password")
.and()
.rememberMe().rememberMeCookieName("RememberMeFromLecture")
.rememberMeParameter("remember")
.key("golqmaTaina")
.and()
.logout().logoutSuccessUrl("/user/login?logout").logoutRequestMatcher(new AntPathRequestMatcher("/signout")).permitAll()
.and()
.exceptionHandling().accessDeniedPage("/user/unauthorized")
.and().csrf().disable();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception
{
auth.userDetailsService(this.userService).passwordEncoder(getBCryptPasswordEncoder());
}
@Bean
public BCryptPasswordEncoder getBCryptPasswordEncoder()
{
return new BCryptPasswordEncoder();
}
}
이 내 config 파일이며 나머지없이 완벽하게 작동하지만, 내 문제는 단지 모두의 나머지와 함께 작동하도록 로그인 페이지를 만들고 싶어합니다. 이런 식으로 설정하면 로그인이 자동으로 끝났습니다. 컨트롤러 내에서 중단 점을 설정할 수도 없습니다. 그것은 효과가 있지만, 나는 그것을 휴식과 함께 작동하게하고 싶다.
좀 더 구체적으로 pls – Alexander
내 대답을 업데이트 한 적이 있으니 문의 사항이 있으면 알려 주시기 바랍니다. – ManishSingh