Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Custom UsernameTokenManager Problem

Custom UsernameTokenManager Problem

Scheduled Pinned Locked Moved XML / XSL
csharphelpwcfsecurityxml
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gizz
    wrote on last edited by
    #1

    Hi all. WSE 2.0 on .Net 1.1 SP1, C#, Win XP Pro. In a web service, I have a custom UsernameTokenManager, override AuthenticateToken, set up all the relevant stuff to make it use the WSE, but it never calls AuthenticateToken, simply fails on the standard default AuthenticateToken. Microsoft.Web.Services2.Security.SecurityFault: The security token could not be authenticated or authorized at Microsoft.Web.Services2.Security.Tokens.UsernameTokenManager.OnLogonUserFailed(UsernameToken token) Am I missing anything simple? My custom UsernameTokenManager: [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)] public class UsernameManager : UsernameTokenManager { protected override string AuthenticateToken(UsernameToken token) { // Ensure the SOAP message contained a UsernameToken. if (token == null) throw new ArgumentNullException(); return "password"; } } In my web service web.config file I have <microsoft.web.services2> <diagnostics /> <security> <securityTokenManager type="WebServiceNamespace.UsernameManager, WebServiceDllName" xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext" qname="wsse:UsernameToken" /> </security> </microsoft.web.services2> My proxy class for the service is derived from WebServicesClientProtocol. In my call to the web service, I do this: Myservice svc = new Myservice(); UsernameToken tok = new UsernameToken("admin", "password", PasswordOption.SendPlainText); svc.RequestSoapContext.Security.Tokens.Add(tok); svc.AFunctiononTheService(); I guess its something simple that I'm missing, but I'm struggling to identify it! Help! :doh: :sigh: :confused:

    D 1 Reply Last reply
    0
    • G Gizz

      Hi all. WSE 2.0 on .Net 1.1 SP1, C#, Win XP Pro. In a web service, I have a custom UsernameTokenManager, override AuthenticateToken, set up all the relevant stuff to make it use the WSE, but it never calls AuthenticateToken, simply fails on the standard default AuthenticateToken. Microsoft.Web.Services2.Security.SecurityFault: The security token could not be authenticated or authorized at Microsoft.Web.Services2.Security.Tokens.UsernameTokenManager.OnLogonUserFailed(UsernameToken token) Am I missing anything simple? My custom UsernameTokenManager: [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)] public class UsernameManager : UsernameTokenManager { protected override string AuthenticateToken(UsernameToken token) { // Ensure the SOAP message contained a UsernameToken. if (token == null) throw new ArgumentNullException(); return "password"; } } In my web service web.config file I have <microsoft.web.services2> <diagnostics /> <security> <securityTokenManager type="WebServiceNamespace.UsernameManager, WebServiceDllName" xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext" qname="wsse:UsernameToken" /> </security> </microsoft.web.services2> My proxy class for the service is derived from WebServicesClientProtocol. In my call to the web service, I do this: Myservice svc = new Myservice(); UsernameToken tok = new UsernameToken("admin", "password", PasswordOption.SendPlainText); svc.RequestSoapContext.Security.Tokens.Add(tok); svc.AFunctiononTheService(); I guess its something simple that I'm missing, but I'm struggling to identify it! Help! :doh: :sigh: :confused:

      D Offline
      D Offline
      doogie
      wrote on last edited by
      #2

      hi!!! Try changing your xmlns for this one : xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" bye

      G 1 Reply Last reply
      0
      • D doogie

        hi!!! Try changing your xmlns for this one : xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" bye

        G Offline
        G Offline
        Gizz
        wrote on last edited by
        #3

        Thanks, that was spot on! :-D

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups