Windows Authentication Timeout
From: Will Gillen (g_i_l_l_e_0_0_1__at__n_s_u_o_k_._e_d_u)
Date: 11/10/04
- Next message: Bill: "Re: Delayed Signing, the GAC, and Installations"
- Previous message: Nicole Calinoiu: "Re: Delayed Signing, the GAC, and Installations"
- Next in thread: Jim Cheshire [MSFT]: "RE: Windows Authentication Timeout"
- Reply: Jim Cheshire [MSFT]: "RE: Windows Authentication Timeout"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 10 Nov 2004 09:16:27 -0600
I have been working on trying to enforce a "timeout" on Windows Integrated
Authentication.
Basically I want the aspx page to force the "authenticated" user to re-enter
their credentials if it has been longer than 3 minutes since their last page
request.
Another individual had suggested adding a value to the Session object, and
setting the page timeout to 3 minutes.
Then, if that value is not present in the Session Object, just return a
Response.StatusCode of "401" to force the browser to "re-authenticate".
I "kinda" got that working, but now the browser is asking for credentials
Twice on the First page request. Then all subsequent requests (after 3
minutes) are only prompting once.
Can anyone help me get this figured out. I'm pretty close, I just need help
in keeping the First Request from prompting Twice for credentials...
This code is at the top of the Page_Load() method of the page I want to
secure:
'Set the Session Timeout to 3 mins:
Session.Timeout = 3
'See if the User.Identity object is already in the Session (means it
hasn't "timed-out"):
If context.Session.Item("USEROBJ") Is Nothing Then
'If New session, then See if they have already been prompted for
creds:
If context.Session.Item("AUTH_PROMPT") = True Then
If context.User.Identity.IsAuthenticated Then
'If they have already been prompted and passed
authentication,
'Then add the User.Identity to the Session:
context.Session.Add("USEROBJ", context.User.Identity)
Else
'Otherwise, respond with "401" to prompt for Creds
again:
Response.StatusCode = 401
End If
Else
'Since this is a new Session, and they haven't been prompted
for creds (as far as I know),
'Then add the "AUTH_PROMPT" flag to the Session, and respond
with "401":
context.Session.Add("AUTH_PROMPT", True)
Response.StatusCode = 401
End If
End If
- Next message: Bill: "Re: Delayed Signing, the GAC, and Installations"
- Previous message: Nicole Calinoiu: "Re: Delayed Signing, the GAC, and Installations"
- Next in thread: Jim Cheshire [MSFT]: "RE: Windows Authentication Timeout"
- Reply: Jim Cheshire [MSFT]: "RE: Windows Authentication Timeout"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|