Java spring Rest和Android
我有java后端的rest服务。我使用Spring安全性。为了让Android应用程序可以使用授权,我需要执行哪些步骤? 目前,所有这些都在网络版本中工作。这是Spring安全配置Java spring Rest和Android,java,android,spring,rest,spring-mvc,Java,Android,Spring,Rest,Spring Mvc,我有java后端的rest服务。我使用Spring安全性。为了让Android应用程序可以使用授权,我需要执行哪些步骤? 目前,所有这些都在网络版本中工作。这是Spring安全配置 public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired AuthenticationService authenticationService; @Override protected
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
AuthenticationService authenticationService;
@Override
protected void configure(HttpSecurity http) throws Exception {
CharacterEncodingFilter filter = new CharacterEncodingFilter();
filter.setEncoding("UTF-8");
filter.setForceEncoding(true);
// отключена защита csrf на время тестов
http.csrf().disable().addFilterBefore(filter,CsrfFilter.class);
http.authorizeRequests().antMatchers("/account/**").hasRole("USER")
.antMatchers("/user/**").hasRole("ADMIN")
.and().formLogin();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(authenticationService);
}
p.S.或任何要执行的步骤,无论谁作为客户。
(我可以通过邮递员进行身份验证)我对这种方法感兴趣,是否有必要单独实施,以便通过Android应用程序登录