我有 2 个应用程序,一个是弹簧靴,另一个是 angular。 目前,我已将我的应用程序与 azure ad 集成在一起,因此通过它进行了身份验证。 现在的问题是,当用户从前端应用注销时,如果令牌未过期,如何使 Azure AD 提供的 JWT 令牌失效。 因为,如果有人能够在用户注销的情况下获得令 ...
提示:本站收集StackOverFlow近2千万问答,支持中英文搜索,鼠标放在语句上弹窗显示对应的参考中文或英文, 本站还提供 中文繁体 英文版本 中英对照 版本,有任何建议请联系yoyou2525@163.com。
我用 jhipster 生成了一个应用程序,并执行了 lib com.microsoft.azure 的所有设置。
登录工作正常,我的问题是如何处理 azure AD 令牌过期(设置为 1 小时后过期)。
我可以使用 SecurityConfiguration 中的过滤器来执行此操作吗?
@Override
public void configure(HttpSecurity http) throws Exception {
// @formatter:off
http
.csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.and()
.addFilterBefore(corsFilter, CsrfFilter.class)
.exceptionHandling()
.accessDeniedHandler(problemSupport)
.and()
.headers()
.contentSecurityPolicy("default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:")
.and()
.referrerPolicy(ReferrerPolicyHeaderWriter.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN)
.and()
.featurePolicy("geolocation 'none'; midi 'none'; sync-xhr 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; speaker 'none'; fullscreen 'self'; payment 'none'")
.and()
.frameOptions()
.deny()
.and()
.authorizeRequests()
.antMatchers("/api/users/**").hasRole("ADMIN")
.and()
.oauth2Login()
.userInfoEndpoint()
.oidcUserService(this.oidcUserService());
// @formatter:on
}
令牌过期时有两种选择:一种是使用refresh token 更新令牌,另一种是再次请求/token
端点以获取新的令牌。
如果访问令牌过期,它将调用refreshAccessToken()
function。 还有一个类似的问题,请参见此处。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.