In your custom UsernameTokenManager : construct a GenericPrincipal object - couple it with some application defined roles and attach the Principal object to Thread.CurrentPrincipal.
Afterwards you will be able to use the normal .NET Role based security infrastructure, e.g.
Thread.CurrentPrincipal.IsInRole()
or
PrincipalPermission.Demand
or
[PrincipalPermission]
---
Dominick Baier - DevelopMentor
http://www.leastprivilege.com
nntp://news.microsoft.com/microsoft.public.dotnet.framework.webservices.enhancements/<TPKRd.596$ZB4.587@newsfe5-gui.ntli.net>
Hi,
I have a web service that has ten web methods associated with it. It
uses WSE2.0 implementation. I have a custom usernametoken manager. I want to
restrict which users use which method, without using WS-Policy (unless it is
simple to use). Any help greatly appreciated.
many thanks.
[microsoft.public.dotnet.framework.webservices.enhancements]
You do not need to attach it to Thread.CurrentPrincipal. You could attach it
to the Principal object exposed from the UsernameToken.
Then in your code you can traverse through all the tokens, and when you find
the username token (after making sure that the same token signed and/or
encrypted the message if you are using a username token to sign or encrypt)
you can just access the usernameToken.Principal.IsInRole() to check for
roles.
Thanks,
Sidd [MSFT]
> In your custom UsernameTokenManager : construct a GenericPrincipal object - couple it with some application defined roles and attach the
Principal object to Thread.CurrentPrincipal.
> Afterwards you will be able to use the normal .NET Role based security infrastructure, e.g.
>
[quoted text clipped - 11 lines]
> Dominick Baier - DevelopMentor
> http://www.leastprivilege.com
nntp://news.microsoft.com/microsoft.public.dotnet.framework.webservices.enhancements/<TPKRd.596$ZB4.587@newsfe5-gui.ntli.net>
> Hi,
> I have a web service that has ten web methods associated with it. It
[quoted text clipped - 5 lines]
>
> [microsoft.public.dotnet.framework.webservices.enhancements]