![](/img/trans.png)
[英]How to remove "Cancel" button from PhoneFactorProtocolProvider in Azure AD B2C Custom Policies?
[英]Spring Boot - Cancel button throws error on Azure AD B2C Policy
我必須在我的 Spring 啟動應用程序上使用關於 Azure AD B2C 的自定義策略。
當我嘗試從忘記密碼策略中“取消”時,它會將我帶到 localhost:8443/login?error。
在該頁面上,它顯示了我
[access_denied] AADB2C90091:用戶已取消輸入自我聲明的信息。 關聯 ID:XXX-XXX-XXX-XXX-XXX 時間戳:2022-03-18 18:00:37Z
Spring Boot出現此類錯誤如何處理? 我在 WebSecurity.java 中做了哪些更改(如果有)?
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/welcome", "/newRegistrationStart", "/logoutSuccess" ).permitAll()
.antMatchers("/images/*").permitAll()
.anyRequest().authenticated()
.and()
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")).logoutSuccessUrl("/logoutSuccess")
.and()
.apply(configurer)
;
}
請檢查以下參考資料是否可以解決:
如果用戶單擊“取消”按鈕,Azure AD B2C 將返回錯誤代碼為 -AADB2C90091 的錯誤響應。 這是預期的行為,因為想法是捕獲這些錯誤代碼並重定向到任何其他頁面,例如主頁或索引頁面,錯誤由應用程序根據發回的代碼進行處理。
要緩解錯誤 AADB2C90091,您必須攔截錯誤響應並防止身份驗證中間件將此錯誤拋回頁面。 用戶被重定向到 redirect_uri 中指定的 url,但出現錯誤。 但是您可以使用 HTML 模板(使用 JavaScript)並添加您自己的鏈接。
或嘗試在 exceptionHandling() 下使用accessDeniedHandler
.requestCache()
.requestCache(myRequestCache)
.and()
.exceptionHandling()
.accessDeniedHandler(myAccessDeniedHandler)
在 accessdeniedhandler 中,您可以重定向到所需的頁面 ex:login 頁面,如下面的參考資料所示。
請參閱: spring - AccessDeniedHandler 重定向到登錄頁面 - Stack Overflow了解更多詳情 & java - 處理 Spring 引導資源服務器中的安全異常 - 堆棧內存溢出
其他參考:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.