MembershipUser.IsApproved and remembered logins

E

Erik Cassel

We use Forms authentication on our website with the "remember me" feature.
When somebody comes back to the site, they are automagically logged on.

We also use the MembershipProvider framework.

Here is the issue: When somebody is banned
(MembershipUser.IsApproved=false) we don't want pre-existing authentication
cookies to work when the banned user returns to the website.

We use a custom MembershipProvider. Therefore, manual login can be prevented
by checking the IsApproved property of the MembershipUser during
MembershipProvider.ValidateUser.

However, if there is a cookie then ValidateUser isn't called, so I can’t
prevent the login.

My workaround is to check IsApproved in Application_AuthenticateRequest. If
it fails, I log the user our and then throw an exception. This workaround
feels forced and not secure since the user had been momentarily authenticated.

Is there a solution that isn’t a hack?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top