getting Authentication type failed in ManagedSecurityContextInformationProvider

Topics: Logging Application Block
Jun 23, 2009 at 12:37 PM

Hi,

we are using Microsoft Enterprise Library for logging errors into db.We are using integrated windows authentication.we have created a user principal object implementing IPrincipal interface with generic identity using dummy username(not a logon windows username) and setting our own authentication type and assigned that created principal to the current thread.But when we tried to populate the dictionary for ManagedSecurityContextProvider using logentry.ExtendedProperties we are getting an exception "Attempted to perform an unauthorized exception".But the same we created a user principal object implementing IPrincipal interface using a logon windows username and authentication type we can successfully populate the dictionary for ManagedSecurityContextProvider.

code creating an exception is :

provider = new Microsoft.Practices.EnterpriseLibrary.Logging.ExtraInformation.ManagedSecurityContextInformationProvider();
provider.PopulateDictionary(logEntry.ExtendedProperties);

Pls help to resolve this issue..

 

 

 

Jun 24, 2009 at 7:43 AM
Edited Jun 24, 2009 at 7:43 AM

Hi,

I'm trying to do a repro of your error but didn't succeed. I just tried it in a simple console app. I created a class that inherits from IPrincipal. used a genericidentity with a dummy username in the Identity property. I assigned the instance of the custom IPrincipal class to the Thread.CurrentPrincipal and executed the code you've provided but have'nt got an error. I may be doing something wrong.. do you have a quick repro for this one?

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 24, 2009 at 9:23 AM

Hi Dudan,

Thanks for your help..

What u have done is exactly right..

What our problem is we are using dummy username for authenticating(but using integrated windows authentication) but when we instantiate ManagedSecurityContextProvider and tried to populate the dictionary, here we got the identity property as windows username and authentication type property raises an exception 'Attempted to perform an unauthorized exception'.And also we are authenticating user with windows username as well in some scenarios.Here we got thro this code without exception we can get the authentication type property and identity property and isauthenticated property successfully.We got the exception only when we are using dummy username for authentication and tried to log the exception using logentry extended properties.

I think you will be clear..

Thanks

 

 

 

Jun 24, 2009 at 11:24 AM

Hi,

I want to send you the sample app that I've created so you may try it in your machine. It's working fine on my machine even on a dummy username. Where can i send the sample app?

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 24, 2009 at 11:29 AM

Hi Dudan,

Thanks...

Pls send that application to sivakumarganeshm@gmail.com

Thanks again...