假设我配置了两个不同网址的API资源:
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case Resource.Id.updateid:
var progressDialog = ProgressDialog.Show(this, "", "Updating...", true);
progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner);
new Thread(new ThreadStart(delegate
{
RunOnUiThread(() =>
{
for (int i = 0; i < 100; i++)
{
eTxt[i].Text = slnArray[i].ToString();
}
progressDialog.Dismiss();
}
);
})).Start();
return true;
default:
return base.OnOptionsItemSelected(item);
}
}
我配置了超时:
@Override
public void configure(HttpSecurity http) throws Exception {
http.exceptionHandling()
.authenticationEntryPoint(customAuthenticationEntryPoint)
.and()
.logout()
.logoutUrl("/oauth/logout")
.logoutSuccessHandler(customLogoutSuccessHandler)
.and()
.csrf()
.requireCsrfProtectionMatcher(new AntPathRequestMatcher("/oauth/authorize"))
.disable()
.headers()
.frameOptions()
.disable()
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers("/api/secure/**").hasAnyAuthority(Authorities.ROLE_USER.name(), Authorities.ROLE_ADMIN.name())
.antMatchers("/admin/**").hasAnyAuthority(Authorities.ROLE_ADMIN.name());
}
如何为/ api / secure / **(如上所述)和/ api / admin / **(refreshToken:20分钟,accessToken:10秒)进行不同的超时?
答案 0 :(得分:0)
您可以使用
添加第二个客户端的配置.and()
.withClient("anotherClient")
.....
运行时使用的客户端取决于客户端指定的内容:
http://localhost:8080/oauth/authorize?
response_type=code
&client_id=anotherClient
&redirect_url=http://client_host?key=value
&scope=read
找到一个好的教程