This tutorial is based on tutorial and sample from https://www.everit.biz/web/guest/everit-blog/-/blogs/single-sign-out-with-cas-in-net and improved some codes to make it working perfectly.
Jasig has already released its .NET CAS client provider. You can check it from Jasig official .NET CAS Client. But in my case I can't use it because I'm not using pure ASP .NET form. Furthermore I'm not using ASP .NET tag at all because I'm using Castle Framework especially Monorail and ActiveRecord. I must use different approach to integrate MaxLogistix to CAS. Then I found and tried this wonderful .NET CAS tutorial. The result is.... it's working!
When I open http://localhost:50780/default.aspx from my web browser, I'm redirected to CAS login screen https://localhost:8443/cas/login?service=http://localhost:50780/CASLogin.aspx. Login service is working well.
|
Login from CAS bring me to http://localhost:50780/default.aspx and it shows welcoming screen and Pentaho Report Viewer that I embed using iframe.
|
I also open Pentaho and it shows Home screen, not login screen. Seems CAS working well.
Is it done? Not yet because I haven't tried single sign out. Let's try single sign out. I log out directly from CAS server.
And I refresh Pentaho Home screen, I'm redirected to CAS login screen.
BUT... when I refreshed http://localhost:50780/default.aspx, I got INTERESTING view. I wasn't redirected to CAS login screen and still in welcome screen, but the embedded Pentaho Report Viewer showed CAS login screen.
The question is... was I logged out or still logged in CAS? The answer is I was already logged out from CAS. Open https://localhost:8443/cas and it will bring you to login screen.
Furthermore, I always got this error when I was debugging this sample
After spent several hours debugging and learning this source code, I found two things that made these two problems.
Now we can embed Pentaho dashboard and report viewer using CAS perfectly ;)
|
And I refresh Pentaho Home screen, I'm redirected to CAS login screen.
|
BUT... when I refreshed http://localhost:50780/default.aspx, I got INTERESTING view. I wasn't redirected to CAS login screen and still in welcome screen, but the embedded Pentaho Report Viewer showed CAS login screen.
|
The question is... was I logged out or still logged in CAS? The answer is I was already logged out from CAS. Open https://localhost:8443/cas and it will bring you to login screen.
Furthermore, I always got this error when I was debugging this sample
|
After spent several hours debugging and learning this source code, I found two things that made these two problems.
- When CAS logging out, .NET sample application still hold its ticket in its session so that it won't bring us to login screen. The solution is adding several codes to remove ticket from session when get logout request from CAS.
- There is an overlap event between checking ticket function and other function. When checking ticket function triggered (via timer), another function hasn't finished its process. The error is created because a function is trying to read a variable that locked in another function. The solution for this problem is adding exception handler that do nothing when this overlap event happened.
|
Now we can embed Pentaho dashboard and report viewer using CAS perfectly ;)
You can download and compare these sample codes:
NOTE:
NOTE:
My sample code doesn't use URL Rewrite so that it won't be displayed in other browser but Chrome. You can use URL Rewrite I wrote about in Embed Pentaho Report Viewer.