Re: IsAuthenticated property on IIdentity interface
From: Nicole Calinoiu (calinoiu)
Date: 04/21/05
- Next message: Nicole Calinoiu: "Re: running dll from a network share"
- Previous message: Oriane: "Re: IsAuthenticated property on IIdentity interface"
- In reply to: Oriane: "Re: IsAuthenticated property on IIdentity interface"
- Next in thread: Oriane: "Re: IsAuthenticated property on IIdentity interface"
- Reply: Oriane: "Re: IsAuthenticated property on IIdentity interface"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 21 Apr 2005 07:08:26 -0400
"Oriane" <Oriane@Guermantes.com> wrote in message
news:uO3aO6kRFHA.356@TK2MSFTNGP14.phx.gbl...
> Hi Nicole,
>
> I use the "default" identity type from the Enterprise Library, using a
> login/password authentication scheme. It is using GenericIdentity. In that
> precise case, the constructor :
> new GenericIdentity(namePasswordCredentials.Name, GetAuthenticationType())
>
> I have the feeling that this constructor returns the object with a
> "IsAuthenticated" property "set" to "true".
Yes. As soon as you specify a non-empty name,
GenericIdentity.IsAuthenticated will return true. You could still use
GenericIdentity as your IIdentity implementation. However, if you do, you
shouldn't assign it unless the user is actually authenticated.
> In my application, I want to authenticate users by comparing a
> login/password with database values. It's a .NET Windows Form app (not an
> ASP.NET one). Should I use the FormsIdentity class or is this class only
> to
> be used for ASP.NET application ?
FormsIdentity is almost certainly a worse choice than GenericIdentity for
your scenario. There are at least a couple of reasons for this:
1. FormsIdentity.IsAuthenticated always returns true, so it's actually
even less flexible than GenericIdentity wrt your desired behaviour.
2. Use of FormsIdentity requires AspNetHostingPermission, which is a wee
bit of a pain to grant to partially trusted non-ASP.NET code.
If you really want a variation of the theme of GenericIdentity that simply
adds construction-time specification of authentication status, why not just
create your own implementation that derives from GenericIdentity? That
said, I am a wee bit skeptical of what use one might have constructing an
identity object based on the self-declared name of a user before the user is
actually authenticated, but ymmv...
>
> Thanks
>
> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
> news:%23EYCWRcRFHA.1396@TK2MSFTNGP10.phx.gbl...
>> Each type that implements the interface may implement the logic behind
>> the
>> property in a different way. For example,
>> System.Security.Principal.GenericIdentity will return true for the
> property
>> iff the identity name is not an empty string. What identity type are you
>> using?
>>
>>
>> "Oriane" <Oriane@Guermantes.com> wrote in message
>> news:eNzZtIcRFHA.2348@tk2msftngp13.phx.gbl...
>> > Hi everybody,
>> >
>> > this property is read-only in the interface IIdentity. I suppose it is
> set
>> > at the creation of the instance, but I cannot find the right
>> > constructor
> ?
>> >
>> > Oriane
>> >
>> >
>>
>>
>
>
- Next message: Nicole Calinoiu: "Re: running dll from a network share"
- Previous message: Oriane: "Re: IsAuthenticated property on IIdentity interface"
- In reply to: Oriane: "Re: IsAuthenticated property on IIdentity interface"
- Next in thread: Oriane: "Re: IsAuthenticated property on IIdentity interface"
- Reply: Oriane: "Re: IsAuthenticated property on IIdentity interface"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|