Re: Custom UsernameTokenManager's AuthenticateToken method is not called.



Hi,

It seems to be an error in the localName value, you are using UserNameToken,
but it should be UsernameToken.

Regards,
Pablo Cibraro.

"DEotw" <DarkEnemyOfTheWorld@xxxxxxxxx> wrote in message
news:1164840146.890618.168030@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am trying to create a custom UsernameTokenManager with WSE 3.0. The
class seems to be be instantiated ( I can debug the constructor as it
runs if I put one in), but the overridden AuthenticateToken method is
never called, instead the normal one is apparently used (I can access
the web services using a local user account. Below I am posting my
CustomUsernameTokenManager class, web.config file and
wse3policyCache.config file. As you can see, I am just trying to get it
to run, I have tried to strip everything down as much as possible. Any
suggestions would be appreciated.I'm not for sure how common a problem
this is, I haven't found anything very helpful on the web. I can
provide more info if needed.

CustomUsernameTokenManager Class:

using System;
using System.Xml;
using System.Security.Permissions;
using System.Web.Security;
using System.Security.Principal;

using Microsoft.Web.Services3.Security;
using Microsoft.Web.Services3.Security.Tokens;

namespace CompanyProject
{

[SecurityPermissionAttribute(SecurityAction.Demand,
Flags=SecurityPermissionFlag.UnmanagedCode)]
public class CustomUsernameTokenManager : UsernameTokenManager
{

protected override string AuthenticateToken(UsernameToken
token)
{
return "test";
}
}
}


Portion of web.config:

<webServices>
<soapExtensionImporterTypes>
<add
type="Microsoft.Web.Services3.Description.WseExtensionImporter,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
</soapExtensionImporterTypes>
<soapServerProtocolFactory
type="Microsoft.Web.Services3.WseProtocolFactory,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
</webServices>
</system.web>
<microsoft.web.services3>
<security>
<securityTokenManager>
<add type="CompanyProject.CustomUsernameTokenManager"
namespace="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
localName="UserNameToken" />
</securityTokenManager>
</security>
<policy fileName="wse3policyCache.config" />
</microsoft.web.services3>


wse3policyCache.config:


<policies
xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";>
<extensions>
<extension name="usernameOverTransportSecurity"
type="Microsoft.Web.Services3.Design.UsernameOverTransportAssertion,
Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
</extensions>
<policy name="usernameTokenSecurity">
<usernameOverTransportSecurity />
</policy>
</policies>



.



Relevant Pages

  • RE: Unable to load custom token manager
    ... >> Inherits UsernameTokenManager ... >> Public Sub CustomAuthentication() ... >> Password As String) As Boolean ... >> Microsoft.Web.Services3.Security.SecureConversationServiceSendSecurityFilter.SecureMessage(SoapEnvelope envelope, Security security) ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Unable to load the Custom Token Manager
    ... I am trying to implement the UsernameTokenManager in WSE 3.0 and override the ... Here is the web.config's security entry: ... But i am unable to understand what is the namespace ... Visual studio 2005). ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Re: UsernameToken and CustomUsernameTokenManager are not calling Authenticate token
    ... tries to authenticate the credentials against a Windows account. ... and see if it picks up your custom UsernameTokenManager. ... > The Client calls a webservice with the following: ... > Every time I call the webservice function an security error occurs. ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • UsernameToken and CustomUsernameTokenManager are not calling Authenticate token
    ... UsernameTokenManager with a function AuthenticateToken(UsernameToken ... The Client calls a webservice with the following: ... Every time I call the webservice function an security error occurs. ... I don't know why but the AuthenticateToken function is never called. ...
    (microsoft.public.dotnet.framework.webservices.enhancements)