Hi Hooman,

I would recommend that you either write an HttpModule or add code to 
Global.asax to handle the AuthorizeRequest event.  By the time that event 
fires, you can easily inspect whether or not the request is authenticated 
(HttpContext's User.Identity.IsAuthenticated property).  If the request is 
authenticated, the CAS HttpModule has set the HttpContext's User.Identity.Name 
as the username that the user logged in with and you can perform checks, and 
return HTTP/401's or  redirect as appropriate.

Take a look at the code in the CAS client, or look at 
System.Web.Security.UrlAuthorizationModule or 
System.Web.Security.FileAuthorizationModule in reflector to see how to properly 
handle send back HTTP status codes and/or to redirect correctly.  If you use 
Response.Redirect, pay attention to the endRequest parameter.  I think you will 
want it to be true but I can't remember off the top of my head.

-ScottH

From: Hooman Tahamtani [mailto:[email protected]]
Sent: Thursday, March 03, 2011 8:02 AM
To: [email protected]
Subject: [cas-dev] CAS .NET redirect problem

Hi,

I am trying to configure the .NET client.  We have users with different access 
levels and 6 letter user ids.  User id's start with a specific letter for each 
access level; let's assume A for all access, G for guest access, L for limited 
access etc.  What I need to achieve is deny access to certain web pages to 
Guest users and at the same time let them access to other pages.  I have tried 
to follow the code through the debugger but when I press the login button on 
the login page it does not come back to the code and I cannot find where I can 
check the netId or user name to allow or disallow them for this certain 
application. I need to catch the service response and check the user Id and 
redirect accordingly or deny access and redirect back to the cas login page.  
Have tried to check for this in the Cas20ServiceTicketValidator.cs without any 
success, also have tried to check the netId in the FormsAuthenticationticket of 
CasAthentication.cs but no success. Appreciate any hints or pointers as how I 
could achieve this.

Thank you in advance for your time and help.

Best Regards,

Hooman Tahamtani


--
You are currently subscribed to 
[email protected]<mailto:[email protected]> as: 
[email protected]<mailto:[email protected]>
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-dev

-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-dev

Reply via email to