![](/img/trans.png)
[英]Spring Boot - Angular CORS issue while redirecting to Keycloak Login Page
[英]Keycloak Required actions - Terms and Conditions - issue in redirecting user back to login page (browser specific)
我的 Keycloak 版本 - 9.0。 應用前端 - Angular 8
我正在啟用條款和條件,並將默認值設置為 true。
我已經按照我想要的方式配置了 t&c 頁面,當用戶輸入他們的憑據時它就會出現。 接受 t&c 工作正常,它需要用戶申請。
但問題是當用戶點擊拒絕時。 理想情況下,它應該將用戶帶回 keycloak 登錄頁面,但它會將用戶帶到帶有空白頁面的應用程序頁面,並且當您進行頁面刷新時,它會將用戶帶回 Keycloak 登錄頁面。
問題出在 Safari (13.1.1) 和 Google Chrome (87.0.4) 上,並且在 mozila Firefox (81.0) 上運行良好,它將用戶帶回登錄頁面。
這是我在日志中得到的:
WARN [org.keycloak.events](默認任務 3)type=CUSTOM_REQUIRED_ACTION_ERROR,realmId=myrealm,clientId=myclient,userId=userId,ipAddress=myip,error=rejected_by_user,auth_method=openid-connect,custom_required_action=terms_and_conditions,response_type=代碼,redirect_uri=https://domain_name/,remember_me=false,code_id=code_id,response_mode=fragment,username=username,authSessionParentId=fb55e9cf-fe78-41f7-bf04-ed4d5867d3f9,authSessionTabId=ecxUmJlMtoo
這里有什么遺漏嗎?..為什么特定瀏覽器的問題..有什么想法嗎? 請幫忙..
更新:我觀察到當它在 Mozilla Firefox 中工作時,它仍然在日志中顯示上述警告。
更新 2
I have checked on Mozilla Firefox where its working - In Cookies I can see AUTH_SESSION_ID and KC_RESTART and when I click on decline, auth_session_id get replaced with OAuth_Token_Request_State and then again I can see AUTH_SESSION_ID and KC_RESTART are persisted when it redirects me to login page.
但 Chrome 和 Safari 的情況並非如此。當我點擊拒絕時,cookies 都消失了,我需要在 keycloak 上應用 url 而不是返回登錄頁面。
在你的keycloak.init
調用周圍拋出一個 try/catch ,因為init
在這種情況下會引發錯誤。 在 catch 調用 keycloak.logout() 內清除 state。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.