[英]Spring RESTful Web Service and Android Authentication
我有以下Spring Security配置。
@Override
protected void configure(HttpSecurity http) throws Exception
{
http
.authorizeRequests()
.antMatchers("/admin/**").hasRole("ADMIN")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.permitAll();
}
它工作正常,但我想擁有使用REST API的Android客戶端應用程序。 當我在Android應用程序中使用API時,會將我重定向到Web登錄頁面。 這是理想的行為,但僅在Web應用程序中。
我具有Speditor,Accountant,Driver等角色。除Driver之外,所有其他人都應該能夠登錄Web應用程序。 在android上,我想要單獨登錄,該登錄僅對具有驅動程序角色的用戶進行身份驗證。
問題是我不知道如何分隔這些身份驗證,因此兩個應用程序(Web和Android)可以使用相同的API。 你能給我一些建議嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.