保护spring启动应用程序微服务
目标:创建一个微服务,作为所有其他微服务的安全管理器 我得到的是一个带有示例java配置的微服务保护spring启动应用程序微服务,spring,spring-security,spring-boot,Spring,Spring Security,Spring Boot,目标:创建一个微服务,作为所有其他微服务的安全管理器 我得到的是一个带有示例java配置的微服务 protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() .antMatchers("/css/**", "/index").permitAll()
protected void configure(HttpSecurity http) throws Exception {
http .csrf().disable()
.authorizeRequests()
.antMatchers("/css/**", "/index").permitAll()
.antMatchers("/user/**").hasRole("USER")
.antMatchers("/tryadmin").hasRole("ADMIN")
.antMatchers("/try").hasRole("USER")
.and()
.exceptionHandling()
.authenticationEntryPoint(entryPoint)
.and()
.formLogin()
.usernameParameter("username")
.passwordParameter("password")
.successHandler(loginSuccessHandler)
.and()
.sessionManagement()
.enableSessionUrlRewriting(true)
.maximumSessions(1);
}
但是AntMatcher正在应用程序上下文中寻找rest服务。i、 它正在security manager微服务中寻找rest服务
但是我想做的是,我想对请求进行身份验证和授权,我不想像antMatcher那样调用应用程序上下文中的服务。相反,我希望在身份验证和授权之后得到一个200 ok的响应