Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java spring Rest和Android_Java_Android_Spring_Rest_Spring Mvc - Fatal编程技术网

Java spring Rest和Android

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

我有java后端的rest服务。我使用Spring安全性。为了让Android应用程序可以使用授权,我需要执行哪些步骤? 目前,所有这些都在网络版本中工作。这是Spring安全配置

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应用程序登录