Setting the role in cookie authentication

rated by 0 users
This post has 3 Replies | 2 Followers

Not Ranked
Posts 2
Points 40
DamonJanis Posted: Mon, Jul 9 2007 8:25 AM

How can the users role be set through the authentication cookie?

  • | Post Points: 20
Top 50 Contributor
Posts 322
Points 3,690
CS Developers
Xander replied on Mon, Jul 9 2007 12:51 PM

If you want the roles to be user-specific (different roles for different users) then the best way would be to write a CSModule that will read the roles from the cookie and add the user to the appropriate roles.  

 You can see an example for the beginnings of a CSModule here.

Hope this helps,

 
Xander
 

  • | Post Points: 20
Not Ranked
Posts 2
Points 40

Thanks, this got me going the right direction.

What I haven't been able to figure out or find in the docs is how to read a cookie from inside the CSModule. On a web page I would use Request.Cookies[...].Value to read cookie information but inside a CSModule what is available to get access to Community Server's HttpRequest object?

  • | Post Points: 20
Top 50 Contributor
Posts 322
Points 3,690
CS Developers
Xander replied on Wed, Jul 11 2007 11:45 AM

You can access the current request via System.Web.HttpContext.Current.Request...


Hope this helps,

Xander
 

  • | Post Points: 5
Page 1 of 1 (4 items) | RSS
Powered by Community Server (Commercial Edition), by Telligent Systems

Copyright© 2008 Telligent Systems Inc. All rights reserved
CommunityServer.com  •  Telligent.com