Custom UsernameTokenManager Problem
-
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: -
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: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
-
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