Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / November 2006

Tip: Looking for answers? Try searching our database.

Custom UsernameTokenManager's AuthenticateToken method is not called.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DEotw - 29 Nov 2006 22:42 GMT
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>
Pablo Cibraro [MVP] - 30 Nov 2006 14:52 GMT
Hi,

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

Regards,
Pablo Cibraro.

>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
[quoted text clipped - 75 lines]
>  </policy>
> </policies>
DEotw - 30 Nov 2006 15:35 GMT
That seemed to take care of it. I didn't realize that localName had
anything to do with the policy name, so I did not pay any much
attention to it. Thanks for the help.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.