Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Azman returns cached roles to .Net API

Reply
Thread Tools

Azman returns cached roles to .Net API

 
 
Enrique Vargas
Guest
Posts: n/a
 
      01-27-2006
Hi, I'm using Active Directory as Membership Provider and Azman as
RoleProvider, everything works fine except that any change made in Azman
after the ASP.NET 2.0 APP is
initialized returns a cached version of the roles information. The APP needs
to know about any change produced while is running. Any idea why Azman is
returning a cache version of the roles definitions.Thanks.


 
Reply With Quote
 
 
 
 
Dominick Baier [DevelopMentor]
Guest
Posts: n/a
 
      01-28-2006
Hi,

have you tried disabling caching in the roles configuration?

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

> Hi, I'm using Active Directory as Membership Provider and Azman as
> RoleProvider, everything works fine except that any change made in
> Azman
> after the ASP.NET 2.0 APP is
> initialized returns a cached version of the roles information. The APP
> needs
> to know about any change produced while is running. Any idea why Azman
> is
> returning a cache version of the roles definitions.Thanks



 
Reply With Quote
 
 
 
 
Enrique Vargas
Guest
Posts: n/a
 
      01-30-2006
Yes,,

<roleManager enabled="true" cacheRolesInCookie="false"
defaultProvider="RoleManagerAzManProvider" cookieRequireSSL="false"
cookieSlidingExpiration="false" createPersistentCookie="false"
cookieProtection="All" >
<providers>
<add name= xxx />
</providers>
</roleManager>

"Enrique Vargas" <> wrote in message
news:%...
> Hi, I'm using Active Directory as Membership Provider and Azman as
> RoleProvider, everything works fine except that any change made in Azman
> after the ASP.NET 2.0 APP is
> initialized returns a cached version of the roles information. The APP
> needs to know about any change produced while is running. Any idea why
> Azman is returning a cache version of the roles definitions.Thanks.
>



 
Reply With Quote
 
Dominick Baier [DevelopMentor]
Guest
Posts: n/a
 
      01-30-2006
Hi,

ok - i have to look at the source code then.

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

> Yes,,
>
> <roleManager enabled="true" cacheRolesInCookie="false"
> defaultProvider="RoleManagerAzManProvider" cookieRequireSSL="false"
> cookieSlidingExpiration="false" createPersistentCookie="false"
> cookieProtection="All" >
> <providers>
> <add name= xxx />
> </providers>
> </roleManager>
> "Enrique Vargas" <> wrote in message
> news:%...
>
>> Hi, I'm using Active Directory as Membership Provider and Azman as
>> RoleProvider, everything works fine except that any change made in
>> Azman
>> after the ASP.NET 2.0 APP is
>> initialized returns a cached version of the roles information. The
>> APP
>> needs to know about any change produced while is running. Any idea
>> why
>> Azman is returning a cache version of the roles definitions.Thanks



 
Reply With Quote
 
Enrique Vargas
Guest
Posts: n/a
 
      01-30-2006
Web.Config

1.Connection Strings.
<add name="ADConnectionString"
connectionString="LDAP://server.domain.local/CN=Users,DC=domain,DC=local"/>
<add name="AzManConnectionString"
connectionString="msldap://server/CN=store,DC=domain,DC=local"/>

2.<membership defaultProvider="MyADMembershipProvider">
<providers>
<add name="MyADMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershi pProvider, System.Web,
Version=2.0.0.0, &#xA; Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ADConnectionString"
connectionUsername="domain\Administrator" connectionPassword="pass@word1"
connectionProtection="Secure" enableSearchMethods="true"
attributeMapUsername="sAMAccountName" minRequiredPasswordLength="7"
applicationName="APP" minRequiredNonalphanumericCharacters="1"/>
</providers>
</membership>

3.<roleManager enabled="true" cacheRolesInCookie="false"
defaultProvider="RoleManagerAzManProvider" cookieTimeout="30"
cookieRequireSSL="false" cookieSlidingExpiration="false"
createPersistentCookie="false" cookieProtection="All" >
<providers>
<add name="RoleManagerAzManProvider"
type="System.Web.Security.AuthorizationStoreRolePr ovider, System.Web,
Version=2.0.0.0, &#xA; Culture=neutral,
publicKeyToken=b03f5f7f11d50a3a" connectionStringName="AzManADAMServer"
applicationName="APP"/>
</providers>
</roleManager>

4.<authentication mode="Forms">
<forms loginUrl="Login.aspx" defaultUrl="Default.aspx" timeout="30"
protection="All" requireSSL="false" slidingExpiration="false"
cookieless="UseCookies"/>
</authentication>

5. <authorization>
<deny users="?"/>
</authorization>

Simple Test Page .aspx.

If User.Identity.IsAuthenticated Then


Dim rp As RolePrincipal = CType(User, RolePrincipal)

Dim roleInfo As StringBuilder = New StringBuilder
roleInfo.AppendFormat("<h2>Welcome {0}</h2>", rp.Identity.Name)
roleInfo.AppendFormat("<b>Provider:</b> {0}<BR>",
rp.ProviderName)
roleInfo.AppendFormat("<b>Version:</b> {0}<BR>", rp.Version)
roleInfo.AppendFormat("<b>Expires at:</b> {0}<BR>",
rp.ExpireDate)
roleInfo.AppendFormat("<b>Cache List Changed:</b> {0}<BR>",
rp.CachedListChanged)
roleInfo.AppendFormat("<b>Is role List Cached:</b> {0}<BR>",
rp.IsRoleListCached)
roleInfo.Append("<b>Roles:</b> ")

Dim roles() As String = rp.GetRoles

For i As Integer = 0 To roles.Length - 1
roleInfo.Append(", ")
roleInfo.Append(roles(i))
Next

Me.Label1.Text = roleInfo.ToString

End If

"Dominick Baier [DevelopMentor]" <>
wrote in message news:. com...
> Hi,
> ok - i have to look at the source code then.
>
> ---------------------------------------
> Dominick Baier - DevelopMentor
> http://www.leastprivilege.com
>
>> Yes,,
>>
>> <roleManager enabled="true" cacheRolesInCookie="false"
>> defaultProvider="RoleManagerAzManProvider" cookieRequireSSL="false"
>> cookieSlidingExpiration="false" createPersistentCookie="false"
>> cookieProtection="All" >
>> <providers>
>> <add name= xxx />
>> </providers>
>> </roleManager>
>> "Enrique Vargas" <> wrote in message
>> news:%...
>>
>>> Hi, I'm using Active Directory as Membership Provider and Azman as
>>> RoleProvider, everything works fine except that any change made in
>>> Azman
>>> after the ASP.NET 2.0 APP is
>>> initialized returns a cached version of the roles information. The
>>> APP
>>> needs to know about any change produced while is running. Any idea
>>> why
>>> Azman is returning a cache version of the roles definitions.Thanks.

>
>



 
Reply With Quote
 
Dominick Baier [DevelopMentor]
Guest
Posts: n/a
 
      01-30-2006
Hi,

does RolePrincipal.SetDirty() help?

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

> Web.Config
>
> 1.Connection Strings.
> <add name="ADConnectionString"
> connectionString="LDAP://server.domain.local/CN=Users,DC=domain,DC=loc
> al"/>
> <add name="AzManConnectionString"
> connectionString="msldap://server/CN=store,DC=domain,DC=local"/>
> 2.<membership defaultProvider="MyADMembershipProvider">
> <providers>
> <add name="MyADMembershipProvider"
> type="System.Web.Security.ActiveDirectoryMembershi pProvider,
> System.Web,
> Version=2.0.0.0, &#xA; Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a"
> connectionStringName="ADConnectionString"
> connectionUsername="domain\Administrator"
> connectionPassword="pass@word1"
> connectionProtection="Secure" enableSearchMethods="true"
> attributeMapUsername="sAMAccountName" minRequiredPasswordLength="7"
> applicationName="APP" minRequiredNonalphanumericCharacters="1"/>
> </providers>
> </membership>
> 3.<roleManager enabled="true" cacheRolesInCookie="false"
> defaultProvider="RoleManagerAzManProvider" cookieTimeout="30"
> cookieRequireSSL="false" cookieSlidingExpiration="false"
> createPersistentCookie="false" cookieProtection="All" >
> <providers>
> <add name="RoleManagerAzManProvider"
> type="System.Web.Security.AuthorizationStoreRolePr ovider, System.Web,
> Version=2.0.0.0, &#xA; Culture=neutral,
> publicKeyToken=b03f5f7f11d50a3a"
> connectionStringName="AzManADAMServer"
> applicationName="APP"/>
> </providers>
> </roleManager>
> 4.<authentication mode="Forms">
> <forms loginUrl="Login.aspx" defaultUrl="Default.aspx" timeout="30"
> protection="All" requireSSL="false" slidingExpiration="false"
> cookieless="UseCookies"/>
> </authentication>
> 5. <authorization>
> <deny users="?"/>
> </authorization>
> Simple Test Page .aspx.
>
> If User.Identity.IsAuthenticated Then
>
> Dim rp As RolePrincipal = CType(User, RolePrincipal)
>
> Dim roleInfo As StringBuilder = New StringBuilder
> roleInfo.AppendFormat("<h2>Welcome {0}</h2>",
> rp.Identity.Name)
> roleInfo.AppendFormat("<b>Provider:</b> {0}<BR>",
> rp.ProviderName)
> roleInfo.AppendFormat("<b>Version:</b> {0}<BR>",
> rp.Version)
> roleInfo.AppendFormat("<b>Expires at:</b> {0}<BR>",
> rp.ExpireDate)
> roleInfo.AppendFormat("<b>Cache List Changed:</b>
> {0}<BR>",
> rp.CachedListChanged)
> roleInfo.AppendFormat("<b>Is role List Cached:</b>
> {0}<BR>",
> rp.IsRoleListCached)
> roleInfo.Append("<b>Roles:</b> ")
> Dim roles() As String = rp.GetRoles
>
> For i As Integer = 0 To roles.Length - 1
> roleInfo.Append(", ")
> roleInfo.Append(roles(i))
> Next
> Me.Label1.Text = roleInfo.ToString
>
> End If
>
> "Dominick Baier [DevelopMentor]"
> <> wrote in message
> news:. com...
>
>> Hi,
>> ok - i have to look at the source code then.
>> ---------------------------------------
>> Dominick Baier - DevelopMentor
>> http://www.leastprivilege.com
>>> Yes,,
>>>
>>> <roleManager enabled="true" cacheRolesInCookie="false"
>>> defaultProvider="RoleManagerAzManProvider" cookieRequireSSL="false"
>>> cookieSlidingExpiration="false" createPersistentCookie="false"
>>> cookieProtection="All" >
>>> <providers>
>>> <add name= xxx />
>>> </providers>
>>> </roleManager>
>>> "Enrique Vargas" <> wrote in message
>>> news:%...
>>>> Hi, I'm using Active Directory as Membership Provider and Azman as
>>>> RoleProvider, everything works fine except that any change made in
>>>> Azman
>>>> after the ASP.NET 2.0 APP is
>>>> initialized returns a cached version of the roles information. The
>>>> APP
>>>> needs to know about any change produced while is running. Any idea
>>>> why
>>>> Azman is returning a cache version of the roles definitions.Thanks



 
Reply With Quote
 
Dominick Baier [DevelopMentor]
Guest
Posts: n/a
 
      01-30-2006
Hi,

aah - you have to set the cacheRefreshInterval attribute in the provider
config. It is set to 60 (minutes i guess) by default.

MSDN says

"Gets the number of minutes between refreshes of the cache of the policy-store
data."



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

> Web.Config
>
> 1.Connection Strings.
> <add name="ADConnectionString"
> connectionString="LDAP://server.domain.local/CN=Users,DC=domain,DC=loc
> al"/>
> <add name="AzManConnectionString"
> connectionString="msldap://server/CN=store,DC=domain,DC=local"/>
> 2.<membership defaultProvider="MyADMembershipProvider">
> <providers>
> <add name="MyADMembershipProvider"
> type="System.Web.Security.ActiveDirectoryMembershi pProvider,
> System.Web,
> Version=2.0.0.0, &#xA; Culture=neutral,
> PublicKeyToken=b03f5f7f11d50a3a"
> connectionStringName="ADConnectionString"
> connectionUsername="domain\Administrator"
> connectionPassword="pass@word1"
> connectionProtection="Secure" enableSearchMethods="true"
> attributeMapUsername="sAMAccountName" minRequiredPasswordLength="7"
> applicationName="APP" minRequiredNonalphanumericCharacters="1"/>
> </providers>
> </membership>
> 3.<roleManager enabled="true" cacheRolesInCookie="false"
> defaultProvider="RoleManagerAzManProvider" cookieTimeout="30"
> cookieRequireSSL="false" cookieSlidingExpiration="false"
> createPersistentCookie="false" cookieProtection="All" >
> <providers>
> <add name="RoleManagerAzManProvider"
> type="System.Web.Security.AuthorizationStoreRolePr ovider, System.Web,
> Version=2.0.0.0, &#xA; Culture=neutral,
> publicKeyToken=b03f5f7f11d50a3a"
> connectionStringName="AzManADAMServer"
> applicationName="APP"/>
> </providers>
> </roleManager>
> 4.<authentication mode="Forms">
> <forms loginUrl="Login.aspx" defaultUrl="Default.aspx" timeout="30"
> protection="All" requireSSL="false" slidingExpiration="false"
> cookieless="UseCookies"/>
> </authentication>
> 5. <authorization>
> <deny users="?"/>
> </authorization>
> Simple Test Page .aspx.
>
> If User.Identity.IsAuthenticated Then
>
> Dim rp As RolePrincipal = CType(User, RolePrincipal)
>
> Dim roleInfo As StringBuilder = New StringBuilder
> roleInfo.AppendFormat("<h2>Welcome {0}</h2>",
> rp.Identity.Name)
> roleInfo.AppendFormat("<b>Provider:</b> {0}<BR>",
> rp.ProviderName)
> roleInfo.AppendFormat("<b>Version:</b> {0}<BR>",
> rp.Version)
> roleInfo.AppendFormat("<b>Expires at:</b> {0}<BR>",
> rp.ExpireDate)
> roleInfo.AppendFormat("<b>Cache List Changed:</b>
> {0}<BR>",
> rp.CachedListChanged)
> roleInfo.AppendFormat("<b>Is role List Cached:</b>
> {0}<BR>",
> rp.IsRoleListCached)
> roleInfo.Append("<b>Roles:</b> ")
> Dim roles() As String = rp.GetRoles
>
> For i As Integer = 0 To roles.Length - 1
> roleInfo.Append(", ")
> roleInfo.Append(roles(i))
> Next
> Me.Label1.Text = roleInfo.ToString
>
> End If
>
> "Dominick Baier [DevelopMentor]"
> <> wrote in message
> news:. com...
>
>> Hi,
>> ok - i have to look at the source code then.
>> ---------------------------------------
>> Dominick Baier - DevelopMentor
>> http://www.leastprivilege.com
>>> Yes,,
>>>
>>> <roleManager enabled="true" cacheRolesInCookie="false"
>>> defaultProvider="RoleManagerAzManProvider" cookieRequireSSL="false"
>>> cookieSlidingExpiration="false" createPersistentCookie="false"
>>> cookieProtection="All" >
>>> <providers>
>>> <add name= xxx />
>>> </providers>
>>> </roleManager>
>>> "Enrique Vargas" <> wrote in message
>>> news:%...
>>>> Hi, I'm using Active Directory as Membership Provider and Azman as
>>>> RoleProvider, everything works fine except that any change made in
>>>> Azman
>>>> after the ASP.NET 2.0 APP is
>>>> initialized returns a cached version of the roles information. The
>>>> APP
>>>> needs to know about any change produced while is running. Any idea
>>>> why
>>>> Azman is returning a cache version of the roles definitions.Thanks.



 
Reply With Quote
 
Enrique Vargas
Guest
Posts: n/a
 
      01-30-2006
Hi, u are right Dominick the cacheRefreshInterval does the job, thank u!!

"Dominick Baier [DevelopMentor]" <>
wrote in message news:. com...
> Hi,
> aah - you have to set the cacheRefreshInterval attribute in the provider
> config. It is set to 60 (minutes i guess) by default.
>
> MSDN says
> "Gets the number of minutes between refreshes of the cache of the
> policy-store data."
>
>
> ---------------------------------------
> Dominick Baier - DevelopMentor
> http://www.leastprivilege.com
>
>> Web.Config
>>
>> 1.Connection Strings.
>> <add name="ADConnectionString"
>> connectionString="LDAP://server.domain.local/CN=Users,DC=domain,DC=loc
>> al"/>
>> <add name="AzManConnectionString"
>> connectionString="msldap://server/CN=store,DC=domain,DC=local"/>
>> 2.<membership defaultProvider="MyADMembershipProvider">
>> <providers>
>> <add name="MyADMembershipProvider"
>> type="System.Web.Security.ActiveDirectoryMembershi pProvider,
>> System.Web,
>> Version=2.0.0.0, &#xA; Culture=neutral,
>> PublicKeyToken=b03f5f7f11d50a3a"
>> connectionStringName="ADConnectionString"
>> connectionUsername="domain\Administrator"
>> connectionPassword="pass@word1"
>> connectionProtection="Secure" enableSearchMethods="true"
>> attributeMapUsername="sAMAccountName" minRequiredPasswordLength="7"
>> applicationName="APP" minRequiredNonalphanumericCharacters="1"/>
>> </providers>
>> </membership>
>> 3.<roleManager enabled="true" cacheRolesInCookie="false"
>> defaultProvider="RoleManagerAzManProvider" cookieTimeout="30"
>> cookieRequireSSL="false" cookieSlidingExpiration="false"
>> createPersistentCookie="false" cookieProtection="All" >
>> <providers>
>> <add name="RoleManagerAzManProvider"
>> type="System.Web.Security.AuthorizationStoreRolePr ovider, System.Web,
>> Version=2.0.0.0, &#xA; Culture=neutral,
>> publicKeyToken=b03f5f7f11d50a3a"
>> connectionStringName="AzManADAMServer"
>> applicationName="APP"/>
>> </providers>
>> </roleManager>
>> 4.<authentication mode="Forms">
>> <forms loginUrl="Login.aspx" defaultUrl="Default.aspx" timeout="30"
>> protection="All" requireSSL="false" slidingExpiration="false"
>> cookieless="UseCookies"/>
>> </authentication>
>> 5. <authorization>
>> <deny users="?"/>
>> </authorization>
>> Simple Test Page .aspx.
>>
>> If User.Identity.IsAuthenticated Then
>>
>> Dim rp As RolePrincipal = CType(User, RolePrincipal)
>>
>> Dim roleInfo As StringBuilder = New StringBuilder
>> roleInfo.AppendFormat("<h2>Welcome {0}</h2>",
>> rp.Identity.Name)
>> roleInfo.AppendFormat("<b>Provider:</b> {0}<BR>",
>> rp.ProviderName)
>> roleInfo.AppendFormat("<b>Version:</b> {0}<BR>",
>> rp.Version)
>> roleInfo.AppendFormat("<b>Expires at:</b> {0}<BR>",
>> rp.ExpireDate)
>> roleInfo.AppendFormat("<b>Cache List Changed:</b>
>> {0}<BR>",
>> rp.CachedListChanged)
>> roleInfo.AppendFormat("<b>Is role List Cached:</b>
>> {0}<BR>",
>> rp.IsRoleListCached)
>> roleInfo.Append("<b>Roles:</b> ")
>> Dim roles() As String = rp.GetRoles
>>
>> For i As Integer = 0 To roles.Length - 1
>> roleInfo.Append(", ")
>> roleInfo.Append(roles(i))
>> Next
>> Me.Label1.Text = roleInfo.ToString
>>
>> End If
>>
>> "Dominick Baier [DevelopMentor]"
>> <> wrote in message
>> news:. com...
>>
>>> Hi,
>>> ok - i have to look at the source code then.
>>> ---------------------------------------
>>> Dominick Baier - DevelopMentor
>>> http://www.leastprivilege.com
>>>> Yes,,
>>>>
>>>> <roleManager enabled="true" cacheRolesInCookie="false"
>>>> defaultProvider="RoleManagerAzManProvider" cookieRequireSSL="false"
>>>> cookieSlidingExpiration="false" createPersistentCookie="false"
>>>> cookieProtection="All" >
>>>> <providers>
>>>> <add name= xxx />
>>>> </providers>
>>>> </roleManager>
>>>> "Enrique Vargas" <> wrote in message
>>>> news:%...
>>>>> Hi, I'm using Active Directory as Membership Provider and Azman as
>>>>> RoleProvider, everything works fine except that any change made in
>>>>> Azman
>>>>> after the ASP.NET 2.0 APP is
>>>>> initialized returns a cached version of the roles information. The
>>>>> APP
>>>>> needs to know about any change produced while is running. Any idea
>>>>> why
>>>>> Azman is returning a cache version of the roles definitions.Thanks.

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AzMAN/ADAM-Roles.IsUserInRole() issues Codifier ASP .Net Security 1 01-19-2010 11:10 PM
Azman. Unable to recive rolls from Azman. Lars Sundstrom ASP .Net Security 0 10-09-2008 09:01 AM
cached azMan applications loses its roles Rincewind60 ASP .Net Security 0 11-16-2006 09:39 PM
ADAM/AzMan Does Not Create Roles/Tasks mkc ASP .Net Security 0 10-19-2006 08:21 PM
AzMan: Has anyone created an HTML/Web management console as an alternative to the AzMan MMC? Michael Herman \(Parallelspace/OpenCanal\) ASP .Net Security 0 01-06-2006 01:24 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57