Home All Groups Group Topic Archive Search About

IsAuthenticated property on IIdentity interface

Author
20 Apr 2005 4:01 PM
Oriane
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

Author
20 Apr 2005 4:16 PM
Nicole Calinoiu
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?


Show quoteHide quote
"Oriane" <Ori***@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
>
>
Author
21 Apr 2005 8:45 AM
Oriane
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".


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 ?

Thanks

Show quoteHide quote
"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" <Ori***@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
> >
> >
>
>
Author
21 Apr 2005 11:08 AM
Nicole Calinoiu
"Oriane" <Ori***@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...


Show quoteHide quote
>
> 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" <Ori***@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
>> >
>> >
>>
>>
>
>
Author
21 Apr 2005 12:07 PM
Oriane
Show quote Hide quote
"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
news:OZOf0TmRFHA.3560@TK2MSFTNGP14.phx.gbl...
[...]

> 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?
Absolutely.

> 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...
I'm not sure to understand what you mean by "before the user is
authenticated". In fact, we use the custom authentication which consists of
checking a couple (login/crypted password) with a "security" database,
before the creation of a GenericIdentity object. If the authentication
fails, the object is not created.

We have to release a V1 of our soft with that simple custom auth. method,
but the final target in the V2 is to use a authentication provider (named
Kheops, I don't know if you have ever heard of ?).

Oriane
Show quoteHide quote
>
>
> >
> > 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" <Ori***@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
> >> >
> >> >
> >>
> >>
> >
> >
>
>
Author
21 Apr 2005 1:45 PM
Nicole Calinoiu
"Oriane" <Ori***@Guermantes.com> wrote in message
news:%23RwNqqmRFHA.3296@TK2MSFTNGP15.phx.gbl...
<snip>
> I'm not sure to understand what you mean by "before the user is
> authenticated".

The fact that you want to control the value for the IsAuthenticated property
made me think that you want to have it return false at least some of the
time.  If I'm wrong about this, why isn't GenericIdentity OK for your
purposes?  On the other hand, if my suspicion was correct, under what
circumstances would you want to initialize an identity object for an
unauthenticated user using anything other than a blank name?


> In fact, we use the custom authentication which consists of
> checking a couple (login/crypted password) with a "security" database,
> before the creation of a GenericIdentity object. If the authentication
> fails, the object is not created.

Then why isn't the GenericIdentity.IsAuthenticated behaviour acceptable for
your purposes?


> We have to release a V1 of our soft with that simple custom auth. method,
> but the final target in the V2 is to use a authentication provider (named
> Kheops, I don't know if you have ever heard of ?).

Nope, but I'm not sure that the authentication mechanism is really relevant
here anyway since the identity object would presumably be created after
authentication, regardless of what authentication provider is in place.


Show quoteHide quote
>
> Oriane
>>
>>
>> >
>> > 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" <Ori***@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
>> >> >
>> >> >
>> >>
>> >>
>> >
>> >
>>
>>
>
>
Author
21 Apr 2005 2:06 PM
Oriane
"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
news:up78xinRFHA.3076@tk2msftngp13.phx.gbl...
> "Oriane" <Ori***@Guermantes.com> wrote in message
> news:%23RwNqqmRFHA.3296@TK2MSFTNGP15.phx.gbl...
> <snip>
> The fact that you want to control the value for the IsAuthenticated
property
> made me think that you want to have it return false at least some of the
> time.
That's what I wanted. Now I think I'm wrong,

> If I'm wrong about this, why isn't GenericIdentity OK for your
> purposes?  On the other hand, if my suspicion was correct, under what
> circumstances would you want to initialize an identity object for an
> unauthenticated user using anything other than a blank name?
I agree.

> > In fact, we use the custom authentication which consists of
> > checking a couple (login/crypted password) with a "security" database,
> > before the creation of a GenericIdentity object. If the authentication
> > fails, the object is not created.
>
> Then why isn't the GenericIdentity.IsAuthenticated behaviour acceptable
for
> your purposes?
This behaviour is acceptable to me. I was just wondering if this behaviour
could be improved using a FormsIdentity object. But your answer is clearly
no.

>
> > We have to release a V1 of our soft with that simple custom auth.
method,
> > but the final target in the V2 is to use a authentication provider
(named
> > Kheops, I don't know if you have ever heard of ?).
>
> Nope, but I'm not sure that the authentication mechanism is really
relevant
> here anyway since the identity object would presumably be created after
> authentication, regardless of what authentication provider is in place.
If you are right, how can you explain the following excerpt from the
Entreprise Library source code:


/// <summary>
/// Authentification
/// </summary>
/// <returns></returns>
void Authenticate (string username, string password)
{
bool result = false;
userIdentity = null;
NamePasswordCredential namePasswordCredentials = credentials as
NamePasswordCredential;
if (namePasswordCredentials != null && namePasswordCredentials.Name.Length >
0)
{
SecurityAuthenticationCheckEvent.Fire(namePasswordCredentials.Name);
result = PasswordsMatch(namePasswordCredentials.PasswordBytes,
namePasswordCredentials.Name);
if (result)
{
userIdentity = new GenericIdentity(namePasswordCredentials.Name,
GetAuthenticationType());
}
else
{
SecurityAuthenticationFailedEvent.Fire(namePasswordCredentials.Name);
}
}
return result;
}

???

Oriane
Author
21 Apr 2005 3:09 PM
Nicole Calinoiu
"Oriane" <Ori***@Guermantes.com> wrote in message
news:uU2LZtnRFHA.1268@TK2MSFTNGP14.phx.gbl...
<snip>
> If you are right, how can you explain the following excerpt from the
> Entreprise Library source code:

In this code, a string identifying the authentication provider is all that's
being passed into the identity object.  It looks like the only place the
Enterprise Library code ever actually ends up using this data is in
Microsoft.Practices.EnterpriseLibrary.Logging.ExtraInformation.ManagedSecurityContextInformationProvider.AuthenticationType.
If you don't use either this property or the identity's AuthenticationType
property as a factor in decisions made in your code (or other applications
that might consume data generated from your application), I doubt that a
change in the string returned by this property is likely to have much
effect.
Author
21 Apr 2005 3:35 PM
Oriane
"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
news:%23v8aCSoRFHA.2788@TK2MSFTNGP09.phx.gbl...
> "Oriane" <Ori***@Guermantes.com> wrote in message
> news:uU2LZtnRFHA.1268@TK2MSFTNGP14.phx.gbl...
> <snip>
>
> In this code, a string identifying the authentication provider is all
that's
> being passed into the identity object.  It looks like the only place the
> Enterprise Library code ever actually ends up using this data is in
>
Microsoft.Practices.EnterpriseLibrary.Logging.ExtraInformation.ManagedSecuri
tyContextInformationProvider.AuthenticationType.
> If you don't use either this property or the identity's AuthenticationType
> property as a factor in decisions made in your code (or other applications
> that might consume data generated from your application), I doubt that a
> change in the string returned by this property is likely to have much
> effect.
>
I must admit I'm a bit confused.

I don't intend to use the property "AuthenticationType", but I do use the
"name" property for authorization purpose, via the
PrincipalPermissionAttribute (for instance) which uses a Principal object as
a parameter, referencing a GenericIdentity object.

Hence, I need a GenericIdentity object.

So why this authentication mechanism would not be really relevant ?

Sorry if I'm completely irrelevant !!

Oriane
Author
21 Apr 2005 4:31 PM
Nicole Calinoiu
"Oriane" <Ori***@Guermantes.com> wrote in message
news:utlo3eoRFHA.2736@TK2MSFTNGP09.phx.gbl...
<snip>
> I must admit I'm a bit confused.

So am I.  I thought you were concerned about the use of the authentication
type in the following line:

userIdentity = new GenericIdentity(namePasswordCredentials.Name,
GetAuthenticationType());

If not, what is it about the code excerpt that you posted that you think
might cause problems if you switch authentication providers?  Or does your
concern have nothing to do with the planned switch for your v2?


> I don't intend to use the property "AuthenticationType", but I do use the
> "name" property for authorization purpose, via the
> PrincipalPermissionAttribute (for instance) which uses a Principal object
> as
> a parameter, referencing a GenericIdentity object.
>
> Hence, I need a GenericIdentity object.
>
> So why this authentication mechanism would not be really relevant ?

Because the authentication gets done before the identity object gets
created.  If the user cannot be authenticated (regardless of the
authentication provider), the identity object should not be created.  On the
other hand, if the user is successfully authenticated, the work of the
authentication provider is done, and it (at least in theory <g>) should
probably not be relevant to your application once its work is finished.


Show quoteHide quote
>
> Sorry if I'm completely irrelevant !!
>
> Oriane
>
>
Author
22 Apr 2005 8:49 AM
Oriane
Hi Nicole,

Show quoteHide quote
"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
news:%23T91K$oRFHA.3444@tk2msftngp13.phx.gbl...
> "Oriane" <Ori***@Guermantes.com> wrote in message
> news:utlo3eoRFHA.2736@TK2MSFTNGP09.phx.gbl...
> <snip>
> > I must admit I'm a bit confused.
>
> So am I.  I thought you were concerned about the use of the authentication
> type in the following line:
>
> userIdentity = new GenericIdentity(namePasswordCredentials.Name,
> GetAuthenticationType());
Nope.

> If not, what is it about the code excerpt that you posted that you think
> might cause problems if you switch authentication providers?  Or does your
> concern have nothing to do with the planned switch for your v2?
I give this excerpt to show you that the authentication gets done before the
Identity object gets created.

> > So why this authentication mechanism would not be really relevant ?
>
> Because the authentication gets done before the identity object gets
> created.  If the user cannot be authenticated (regardless of the
> authentication provider), the identity object should not be created.  On
the
> other hand, if the user is successfully authenticated, the work of the
> authentication provider is done, and it (at least in theory <g>) should
> probably not be relevant to your application once its work is finished.
The fact is I need (Enterprise Library needs) an Identity reference. Do you
suggest, following William post, that I could create another
GenericIndentity instance:

GenericIdentity gi = new GenericIdentity(userName, "MyDB");
MessageBox.Show(this, string.Format("Welcome Generic User {0}.", gi.Name));

and use it to create a GenericPrincipal instance ?

If this auth. method is irrelevant, what do you suggest ?

Oriane
Author
22 Apr 2005 10:29 AM
Nicole Calinoiu
"Oriane" <Ori***@Guermantes.com> wrote in message
news:OMiSmgxRFHA.2348@TK2MSFTNGP09.phx.gbl...
> The fact is I need (Enterprise Library needs) an Identity reference.

Even if the user cannot be authenticated?


> Do you
> suggest, following William post, that I could create another
> GenericIndentity instance:
>
> GenericIdentity gi = new GenericIdentity(userName, "MyDB");
> MessageBox.Show(this, string.Format("Welcome Generic User {0}.",
> gi.Name));
>
> and use it to create a GenericPrincipal instance ?

Why would you do this if EL is already creating one for you?  If there's
something wrong with the one being generated by the EL, could you please
specify exactly what the problem is?


> If this auth. method is irrelevant, what do you suggest ?

By the "authentication mechanism", I mean only the process used to verify
the user-provided credentials against some backing store in order to
determine whether the credentials match those of a legitimate user account.
As long as it's possible for your .NET code to communicate with either a
vendor-supplied authentication library/proxy or the backing store, then an
object that implements the IIdentity interface can be created as a result of
a successful authentication.

As far as suggestions, I'm not sure what you're looking for here.  Is there
some specific technical difficulty that you're encountering now, or are you
worried about how use of the Kheops provider will affect a solution that was
built using the EL?  If the latter, could you please provide some additional
details regarding Kheops (e.g.: vendor name, web site, etc.)?
Author
22 Apr 2005 12:00 PM
Oriane
Hi Nicole,

I'm afraid we have to stop this discussion since it is clear that we don't
understand each other.

To be clear :
1> the EL authentication is adressing my pb
2> the Kheops authentication provider is not my pb so far (not before a few
months). Of course I need to have a flexible pattern which allows me to
change easily the authentication provider. Once again EL is perfect for
that.
3> When I've read this sentence in one of your previous post:
"Nope, but I'm not sure that the authentication mechanism is really relevant
here anyway since the identity object would presumably be created after
authentication, regardless of what authentication provider is in place",
I've started to wonder why the EL authentication would be irrelevant for my
scenarios (the present one with a database lookup and those to come with
Kheops or another auth provider)
4> Finally, you seem to agree (but I suppose that in fact you have never
disagree ?) with my/the use of the EL...
so great !!!

Thank you for your posts..

Oriane
Author
22 Apr 2005 12:29 PM
Nicole Calinoiu
"Oriane" <Ori***@Guermantes.com> wrote in message
news:utIquLzRFHA.2384@tk2msftngp13.phx.gbl...
> Hi Nicole,
>
> I'm afraid we have to stop this discussion since it is clear that we don't
> understand each other.

OK.  This will be my last post to this thread unless you respond with any
additional questions.  If you still have any questions or problems on this
issue and would like help from someone else, it might be a good idea to
start a new thread since other folks may assume that your questions have
been answered in this one.


> To be clear :
> 1> the EL authentication is adressing my pb

Unfortunately, I still don't understand why you have a problem with the way
the EL is performing authentication.  You might have better luck getting
help with this if you were to post a specific description and/or example of
the problem you are encountering.


> 2> the Kheops authentication provider is not my pb so far (not before a
> few
> months). Of course I need to have a flexible pattern which allows me to
> change easily the authentication provider. Once again EL is perfect for
> that.

It should be. <g>


> 3> When I've read this sentence in one of your previous post:
> "Nope, but I'm not sure that the authentication mechanism is really
> relevant
> here anyway since the identity object would presumably be created after
> authentication, regardless of what authentication provider is in place",
> I've started to wonder why the EL authentication would be irrelevant for
> my
> scenarios (the present one with a database lookup and those to come with
> Kheops or another auth provider)

I think this is just a terminology disconnect.  As I tried to explain in my
last message, when I use the term "authentication mechanism", I mean the
actual user credential verification performed by the authentication
provider.  For example, in the case of the DbAuthenticationProvider that
ships with the EL, the "authentication mechanism" is a database lookup.
Different providers will use different mechanisms for this verification, and
the EL helps protect your code from this variability.

In other words, I wasn't saying that "EL authentication would be
irrelevant", but that the underlying credentials verification approach used
by your authentication provider of choice should be irrelevant as long as
you are using the EL.


> 4> Finally, you seem to agree (but I suppose that in fact you have never
> disagree ?) with my/the use of the EL...
> so great !!!

The EL should most definitely be sufficiently flexible for your needs.


Show quoteHide quote
>
> Thank you for your posts..
>
> Oriane
>
>
Author
22 Apr 2005 12:41 AM
William Stacey [MVP]
I am a bit confused with what the issue is here.  If your using a DB lookup,
create and return a GenericIdentity instance or error if lookup is bad.
However, you may also consider just use AD or SAM if you already have the
users configured and forget the DB and just use AD or local accounts (or
maybe even ADAM) .  In this case, use something like the WindowsIdentity
method below.  Sample of both methods in the Click method below.  I am also
confused about the ref to Enterprise library as below does not require a
reference to such.  I may be missing something in your requirements.  Let me
know.  Cheers.

private void button22_Click(object sender, System.EventArgs e)
{
string userName = "joedoe";
string pw = "password";
string domain = ".";

/*
  * WindowsIdentity Method using AD or SAM.
  * See WinLogon Helper class at:
  *
http://spaces.msn.com/members/staceyw/Blog/cns!1pnsZpX0fPvDxLKC6rAAhLsQ!283.entry
  */
WindowsPrincipal wp;
bool userGood = WinLogon.TryLogonAs(domain, userName, pw,
LogonType.Network, out wp);
if ( ! userGood )
{
  MessageBox.Show(this, "Logon failed.");
  return;
}

MessageBox.Show(this, string.Format("Welcome {0}", wp.Identity.Name));
// Continue program...

/*
  * GenericIdentity Method using DB.
  * Authenticate user/pw using DB lookup here.
  * If login fails, return error; otherwise continue on.
  */
GenericIdentity gi = new GenericIdentity(userName, "MyDB");
MessageBox.Show(this, string.Format("Welcome Generic User {0}.", gi.Name));
// Continue program...
}

--
William Stacey, MVP
http://mvp.support.microsoft.com

Show quoteHide quote
"Oriane" <Ori***@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".
>
>
> 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 ?
>
> 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" <Ori***@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
>> >
>> >
>>
>>
>
>
Author
22 Apr 2005 8:36 AM
Oriane
Hi William,

I think you are confused because I'm a newbie in the security domain, and
I'm not able to clearly explain my goals.

"William Stacey [MVP]" <staceywREM***@mvps.org> wrote in message
news:ed6C0QtRFHA.3732@tk2msftngp13.phx.gbl...
> I am a bit confused with what the issue is here.  If your using a DB
lookup,
> create and return a GenericIdentity instance or error if lookup is bad.
I'm not sure to clearly understand your sentence.
Do you mean : "create and return a Generic instance (or an error) is bad if
using a DB lookup " (that is inappropriate)  ?

I use the Enterprise Library (EL) and I'm "bound" (for the "V1 release"
only) to use a DB lookup authentication. The "database auth. provider" is
just the default provider of the EL, and althought it could appear to be
inappropriate to create a  GenericIdentity in that precise scenario, it
allows me to change easily for another auth. provider for the "V2".

> However, you may also consider just use AD or SAM if you already have the
> users configured and forget the DB and just use AD or local accounts (or
> maybe even ADAM) .  In this case, use something like the WindowsIdentity
> method below.
Yes that's the point. But I'm not certain to handle Windows accounts in the
future. I will authenticate users with a non Windows auth provider, not
based on AD, neither on ADAM or SAM. So I will create a GenericIdentity, not
a WindowsIndentity.

So the basic question is: do I need to create an "IIdentity" object if I
don't map it with an underlying Windows account ? If not, what is the goal
of the GenericIdentity class ?

I also have to consider future releases of my product with could be used in
a Internet context.

Oriane
Author
23 Apr 2005 1:41 AM
William Stacey [MVP]
No problem.  But did any of my reply help you?  If not, what are you having
problems with?  Cheers.

--
William Stacey, MVP
http://mvp.support.microsoft.com

Show quoteHide quote
"Oriane" <Ori***@Guermantes.com> wrote in message
news:uu9nvZxRFHA.508@TK2MSFTNGP12.phx.gbl...
> Hi William,
>
> I think you are confused because I'm a newbie in the security domain, and
> I'm not able to clearly explain my goals.
>
> "William Stacey [MVP]" <staceywREM***@mvps.org> wrote in message
> news:ed6C0QtRFHA.3732@tk2msftngp13.phx.gbl...
>> I am a bit confused with what the issue is here.  If your using a DB
> lookup,
>> create and return a GenericIdentity instance or error if lookup is bad.
> I'm not sure to clearly understand your sentence.
> Do you mean : "create and return a Generic instance (or an error) is bad
> if
> using a DB lookup " (that is inappropriate)  ?
>
> I use the Enterprise Library (EL) and I'm "bound" (for the "V1 release"
> only) to use a DB lookup authentication. The "database auth. provider" is
> just the default provider of the EL, and althought it could appear to be
> inappropriate to create a  GenericIdentity in that precise scenario, it
> allows me to change easily for another auth. provider for the "V2".
>
>> However, you may also consider just use AD or SAM if you already have the
>> users configured and forget the DB and just use AD or local accounts (or
>> maybe even ADAM) .  In this case, use something like the WindowsIdentity
>> method below.
> Yes that's the point. But I'm not certain to handle Windows accounts in
> the
> future. I will authenticate users with a non Windows auth provider, not
> based on AD, neither on ADAM or SAM. So I will create a GenericIdentity,
> not
> a WindowsIndentity.
>
> So the basic question is: do I need to create an "IIdentity" object if I
> don't map it with an underlying Windows account ? If not, what is the goal
> of the GenericIdentity class ?
>
> I also have to consider future releases of my product with could be used
> in
> a Internet context.
>
> Oriane
>
>
Author
25 Apr 2005 8:45 AM
Oriane
"William Stacey [MVP]" <staceywREM***@mvps.org> a écrit dans le message de news: OlAp9W6RFHA.1***@TK2MSFTNGP14.phx.gbl...
> No problem.  But did any of my reply help you? 
Yes
> If not, what are you having problems with?  Cheers.
I thought I had explained my "problem" in the previous post.
So I repeat:
"The basic question is: do I need to create an "IIdentity" object if Idon't map it with an underlying Windows account ? "

Cheers
Author
25 Apr 2005 3:20 PM
William Stacey [MVP]
IMO, yes.  You need either a GenericIdentity if doing your own
authentication or the a WindowsIdentity if using Windows account.  Then you
can use CLR's role-based security on your methods to allow/disallow access
based on role membership.

--
William Stacey, MVP
http://mvp.support.microsoft.com

"Oriane" <ori***@guermantes.com> wrote in message
news:uvnuuMXSFHA.3972@TK2MSFTNGP14.phx.gbl...

"William Stacey [MVP]" <staceywREM***@mvps.org> a écrit dans le message de
news: OlAp9W6RFHA.1***@TK2MSFTNGP14.phx.gbl...
> No problem.  But did any of my reply help you?
Yes
> If not, what are you having problems with?  Cheers.
I thought I had explained my "problem" in the previous post.
So I repeat:
"The basic question is: do I need to create an "IIdentity" object if Idon't
map it with an underlying Windows account ? "

Cheers
Author
20 Apr 2005 9:00 PM
swat
There are 4 standard identity classes in .NET based on the IIdentity
interface:
1. GenericIdentity
2. WindowsIdentity
3. FormsIdentity
4. PassportIdentity

Note: You can create your own custom Identity class based on IIdentity.

The identity's standard properties (Name, AuthenticationType,
IsAuthenticated) are filled as soon as the user is authenticated. For
example: If a Windows user logs on, the results of the authentication
would be stored in an instance of WindowsIdentity. The
AuthenticationType would be NTLM, the IsAuthenticated property true,
and the Name a string representing the authentication domain and user
name of the user.