views:

24

answers:

1

I have some webserver resources protected with Form based Authentication. The requirement is to have some highly secure resources access result in forced authentication of the user even if he/she is authenticated earlier and have a valid cookie (authentication).

The authentication in a session is maintained by a particular cookie. The first idea to solve this problem is to pass that cookie with "expires" value with back date. But for the form login it is not working, I am getting only login page everytime after providing correct credentials. Cookie with expire value with back date is encountered, cookie is deleted by browser. So this cycle of login is encountered.

Please advise me on what to do.

+2  A: 

At this point authentication isn't enough. You're going to have to implement multiple levels of authorization, with some levels not having persistent tokens. There's a number of resources on the Internet that explain token-based auth.

Basic authentication (not to be confused with the HTTP scheme of the same name) uses only a single token to determine whether the user is logged in or not. Just split the application into multiple authz token realms and handle it from there.

Ignacio Vazquez-Abrams
How does one do that? Do you have some example code? FormsAuthentication is more or less already baked into the system, so the common scenario doesn't require any specialized knowledge of cookies or tokens.
Robert Harvey
@Robert: Sample code would be pointless since it depends on the framework in use, assuming one is even in place.
Ignacio Vazquez-Abrams
OK, you're right. Vague question, vague answer. Vague upvote. +1
Robert Harvey
i agree sample code is pointless. It is simple setup in which we maintain a cookie for authentication. But if it expires value is set to backdate it is deleted by browser.But what Ignacio has suggested seems good to me. I am trying if it works for me. Thanks for reply.@Robert: How is this question and answer vague? My understanding is that this site encourages the sharing of knowledge.
anil