Home All Groups Group Topic Archive Search About

xml based AzMan and ActiveDirectory

Author
15 Sep 2005 3:59 PM
A
Hello

I'm using xml based AzMan (I'm on Win XP) and Active Directory users. I want
to be able to know if a user belongs to a certain role from an app.
If I'm doing like in the code below, I'm not capable to see in the windows
principal the roles defined in the .xml AzMan file.

IAzApplication iapp = this.store.OpenApplication(appName, null);
ArrayList al = new ArrayList();
WindowsPrincipal wp =
(WindowsPrincipal)System.Threading.Thread.CurrentPrincipal;
foreach (IAzRole appRole in iapp.Roles)
{
if (wp.IsInRole(appRole.Name))
{
return true;
}
}

How can I load in the WindowsPrincipal the AzMan roles ? Or how can I check
directly (using the AzMan library) if a user belongs to a role / app. ?

Thank you,
Alina

Author
15 Sep 2005 4:30 PM
Dominick Baier [DevelopMentor]
Hello A,

can you please clarify what you want to achieve?
---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

Show quoteHide quote
> Hello
>
> I'm using xml based AzMan (I'm on Win XP) and Active Directory users.
> I want
> to be able to know if a user belongs to a certain role from an app.
> If I'm doing like in the code below, I'm not capable to see in the
> windows
> principal the roles defined in the .xml AzMan file.
> IAzApplication iapp = this.store.OpenApplication(appName, null);
> ArrayList al = new ArrayList();
> WindowsPrincipal wp =
> (WindowsPrincipal)System.Threading.Thread.CurrentPrincipal;
> foreach (IAzRole appRole in iapp.Roles)
> {
> if (wp.IsInRole(appRole.Name))
> {
> return true;
> }
> }
> How can I load in the WindowsPrincipal the AzMan roles ? Or how can I
> check directly (using the AzMan library) if a user belongs to a role /
> app. ?
>
> Thank you,
> Alina
Author
15 Sep 2005 4:32 PM
A
Hello

I want to check is the user "X" is in the role "Y" in the application "Z"
or if the user "X" is in any of the roles of the application "Z"
the roles being defined in the xml file (by AzMan as interface).

Thank you,
   Alina

Show quoteHide quote
"Dominick Baier [DevelopMentor]" <dbaier@pleasepleasenospamdevelop.com>
wrote in message news:42565460e2c168c7883af6b536e8@news.microsoft.com...
> Hello A,
>
> can you please clarify what you want to achieve?
> ---------------------------------------
> Dominick Baier - DevelopMentor
> http://www.leastprivilege.com
>
>> Hello
>>
>> I'm using xml based AzMan (I'm on Win XP) and Active Directory users.
>> I want
>> to be able to know if a user belongs to a certain role from an app.
>> If I'm doing like in the code below, I'm not capable to see in the
>> windows
>> principal the roles defined in the .xml AzMan file.
>> IAzApplication iapp = this.store.OpenApplication(appName, null);
>> ArrayList al = new ArrayList();
>> WindowsPrincipal wp =
>> (WindowsPrincipal)System.Threading.Thread.CurrentPrincipal;
>> foreach (IAzRole appRole in iapp.Roles)
>> {
>> if (wp.IsInRole(appRole.Name))
>> {
>> return true;
>> }
>> }
>> How can I load in the WindowsPrincipal the AzMan roles ? Or how can I
>> check directly (using the AzMan library) if a user belongs to a role /
>> app. ?
>>
>> Thank you,
>> Alina
>
>
Author
15 Sep 2005 5:49 PM
Dominick Baier [DevelopMentor]
Hello A,

i used the following code

        private string[] getRoles(IAzClientContext context)
        {
            object[] a;
            try
            {
                a = (object[]) context.GetRoles("");
            }
            catch (COMException ex)
            {
                throw new AzMethodException(ex, "IAzClientContext.GetRoles");
            }
            string[] roles = new string[a.Length];
            Array.Copy(a, roles, a.Length);
            return roles;
        }

i implemented a AzManPrincipal - and the code you see is part of the IPrincipal.IsInRole
method

you can read more here, too:
http://www.leastprivilege.com/SearchView.aspx?q=azman

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

Show quoteHide quote
> Hello
>
> I want to check is the user "X" is in the role "Y" in the application
> "Z"
> or if the user "X" is in any of the roles of the application "Z"
> the roles being defined in the xml file (by AzMan as interface).
> Thank you,
> Alina
> "Dominick Baier [DevelopMentor]"
> <dbaier@pleasepleasenospamdevelop.com> wrote in message
> news:42565460e2c168c7883af6b536e8@news.microsoft.com...
>
>> Hello A,
>>
>> can you please clarify what you want to achieve?
>> ---------------------------------------
>> Dominick Baier - DevelopMentor
>> http://www.leastprivilege.com
>>> Hello
>>>
>>> I'm using xml based AzMan (I'm on Win XP) and Active Directory
>>> users.
>>> I want
>>> to be able to know if a user belongs to a certain role from an app.
>>> If I'm doing like in the code below, I'm not capable to see in the
>>> windows
>>> principal the roles defined in the .xml AzMan file.
>>> IAzApplication iapp = this.store.OpenApplication(appName, null);
>>> ArrayList al = new ArrayList();
>>> WindowsPrincipal wp =
>>> (WindowsPrincipal)System.Threading.Thread.CurrentPrincipal;
>>> foreach (IAzRole appRole in iapp.Roles)
>>> {
>>> if (wp.IsInRole(appRole.Name))
>>> {
>>> return true;
>>> }
>>> }
>>> How can I load in the WindowsPrincipal the AzMan roles ? Or how can
>>> I
>>> check directly (using the AzMan library) if a user belongs to a role
>>> /
>>> app. ?
>>> Thank you,
>>> Alina
Author
15 Sep 2005 9:19 PM
A
Thank you

Show quoteHide quote
"Dominick Baier [DevelopMentor]" <dbaier@pleasepleasenospamdevelop.com>
wrote in message news:42565460e2c928c78845f6c43b48@news.microsoft.com...
> Hello A,
>
> i used the following code
>
> private string[] getRoles(IAzClientContext context)
> {
> object[] a;
> try
> {
> a = (object[]) context.GetRoles("");
> }
> catch (COMException ex)
> {
> throw new AzMethodException(ex, "IAzClientContext.GetRoles");
> }
> string[] roles = new string[a.Length];
> Array.Copy(a, roles, a.Length);
> return roles;
> }
>
> i implemented a AzManPrincipal - and the code you see is part of the
> IPrincipal.IsInRole method
>
> you can read more here, too:
> http://www.leastprivilege.com/SearchView.aspx?q=azman
>
> ---------------------------------------
> Dominick Baier - DevelopMentor
> http://www.leastprivilege.com
>
>> Hello
>>
>> I want to check is the user "X" is in the role "Y" in the application
>> "Z"
>> or if the user "X" is in any of the roles of the application "Z"
>> the roles being defined in the xml file (by AzMan as interface).
>> Thank you,
>> Alina
>> "Dominick Baier [DevelopMentor]"
>> <dbaier@pleasepleasenospamdevelop.com> wrote in message
>> news:42565460e2c168c7883af6b536e8@news.microsoft.com...
>>
>>> Hello A,
>>>
>>> can you please clarify what you want to achieve?
>>> ---------------------------------------
>>> Dominick Baier - DevelopMentor
>>> http://www.leastprivilege.com
>>>> Hello
>>>>
>>>> I'm using xml based AzMan (I'm on Win XP) and Active Directory
>>>> users.
>>>> I want
>>>> to be able to know if a user belongs to a certain role from an app.
>>>> If I'm doing like in the code below, I'm not capable to see in the
>>>> windows
>>>> principal the roles defined in the .xml AzMan file.
>>>> IAzApplication iapp = this.store.OpenApplication(appName, null);
>>>> ArrayList al = new ArrayList();
>>>> WindowsPrincipal wp =
>>>> (WindowsPrincipal)System.Threading.Thread.CurrentPrincipal;
>>>> foreach (IAzRole appRole in iapp.Roles)
>>>> {
>>>> if (wp.IsInRole(appRole.Name))
>>>> {
>>>> return true;
>>>> }
>>>> }
>>>> How can I load in the WindowsPrincipal the AzMan roles ? Or how can
>>>> I
>>>> check directly (using the AzMan library) if a user belongs to a role
>>>> /
>>>> app. ?
>>>> Thank you,
>>>> Alina
>
>