Groups | Blog | Home
all groups > dotnet web services enhancements > august 2004 >

dotnet web services enhancements : Roles from Policy


Ilvy
8/18/2004 1:07:02 AM
Is there some way that I can retrieve the roles of my webservice in my custom
UsernameTokenManager from policy?
I defined all the roles in policy and I can retrieve all the roles that the
person is in who is calling the webservice. Now I'd like to know which roles
you have to be in to access the webservice :)
Because I defined them in policy, I want to prevent having to copy paste
them in my code, and prefer to access policy programmaticly in some way
unknown to me :)

HongMei Ge
8/18/2004 10:14:06 PM
Hi!

You can try to retrieve this role information from the
LoadSecurityTokenAssertion method in your customized UsernameTokenManager.

public class MyUsernameTokenManager: UsernameTokenManager {
public override ISecurityTokenAssertion
LoadSecurityTokenAssertion(XmlElement element)

{

/* parse the element to get the role element

this element should look like

<SecurityToken xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext">

<wssp:TokenType>http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-user
name-token-profile-1.0#UsernameToken</wssp:TokenType>
<wssp:Claims>
<wssp:UsePassword wsp:Usage="wsp:Rejected" />

<wse:Role>Administrator</wse:Role>
</wssp:Claims>
</SecurityToken>

*/



// Do not foget to invoke the base class

return base.LoadSecurityTokenManager(element);

}

}

Hope this helps.

hongmei

[quoted text, click to view]

Ilvy
8/19/2004 5:27:02 AM
Hi!

Thanks a lot!! I wasn't sure on how to use that method, or what it was for
;D even though I looked up all the SecurityTokenManager methods. But this was
exactly the information that I needed! Thanks!!!

Ilvy
AddThis Social Bookmark Button