參考: Using CAS without the Login Screen方式一:主要思路是在前端控制url 跳轉,其實也是請求SSO Server。文中說的 AJAX 和 IFrames 應該都是可以成功的。(我對前端一竅不通。)另外應該也可以在後臺 使用 request 庫進行請求Server 但不進行URL 跳轉。個人思路: 是透過Client 網站也進行Server Login, 這樣登入冗餘,而且改動會很大。所以沒進行深入研究。準備用方式一進行解決。Proposed Solutions that do not work
There have been two proposals, which we haven"t found to be suitable:
AJAX: Ajax requests are sandboxed and that sandbox is even more strict than the two-dot rule applied to cookies: It really has to be exactly the same server name in order to workIFrames: In this posting to the cas-dev mailing list, it has been suggested to use an iFrame to embed a login panel on a remote site. This has two limitations:How to get rid of the Frame after login? in the default view a successful login would lead to redirect only in that frame. If you use target="parent" in the from tag, how do you display errors then?You would have limited layout possibilities.
So for our requirements, none of the proposed solutions were adequate.
Our Solution
We decided to use Javascript triggered redirects, which allows us to use this mechanism also on static html pages (e.g. CMS based contents). While loading we request a login ticket, then the login form displays and then it submits to the CAS login URL. If Errors are present at CAS we redirect to the referring page, adding a parameter "error_message" to that request.
參考: Using CAS without the Login Screen方式一:主要思路是在前端控制url 跳轉,其實也是請求SSO Server。文中說的 AJAX 和 IFrames 應該都是可以成功的。(我對前端一竅不通。)另外應該也可以在後臺 使用 request 庫進行請求Server 但不進行URL 跳轉。個人思路: 是透過Client 網站也進行Server Login, 這樣登入冗餘,而且改動會很大。所以沒進行深入研究。準備用方式一進行解決。Proposed Solutions that do not work
There have been two proposals, which we haven"t found to be suitable:
AJAX: Ajax requests are sandboxed and that sandbox is even more strict than the two-dot rule applied to cookies: It really has to be exactly the same server name in order to workIFrames: In this posting to the cas-dev mailing list, it has been suggested to use an iFrame to embed a login panel on a remote site. This has two limitations:How to get rid of the Frame after login? in the default view a successful login would lead to redirect only in that frame. If you use target="parent" in the from tag, how do you display errors then?You would have limited layout possibilities.So for our requirements, none of the proposed solutions were adequate.
Our SolutionWe decided to use Javascript triggered redirects, which allows us to use this mechanism also on static html pages (e.g. CMS based contents). While loading we request a login ticket, then the login form displays and then it submits to the CAS login URL. If Errors are present at CAS we redirect to the referring page, adding a parameter "error_message" to that request.