WSE 2.0 - The security token could not be authenticated or authori

Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default WSE 2.0 - The security token could not be authenticated or authori

    I posted this to microsoft.public.dotnet.framework.webservices.enha ncements a few days ago, but I'm not getting any helpful responses. I hope someone can help.

    Here's my code for the Web Service (SimpleWseServer.ServicesMain.asmx)
    [WebMethod]
    public string HelloWorld(string username)
    {
    SoapContext ctxt = RequestSoapContext.Current;
    foreach(SecurityToken token in ctxt.Security.Tokens)
    {
    if(token is UsernameToken)
    {
    UsernameToken user = (UsernameToken)token;
    if(user.Username==username)
    {
    if(user.Principal.IsInRole(System.Net.Dns.GetHostN ame() + @"\Kings"))
    return "Hello, King " + username;
    return "Hello, " + username;
    }
    }
    }
    return "Hello, Liar";
    }

    Here the client code (it's a button click event in a WindowsForm)
    private void btn_login_Click(object sender, System.EventArgs e)
    {
    string username = txt_username.Text;
    string password = txt_password.Text;
    SimpleWseClient.localhost.ServicesMainWse proxy = new
    SimpleWseClient.localhost.ServicesMainWse();
    proxy.Url = "http://localhost/SimpleWseServer/ServicesMain.asmx";
    proxy.RequestSoapContext.Security.Tokens.Add(new UsernameToken(username,
    password, PasswordOption.SendPlainText));
    txt_response.Text = proxy.HelloWorld(username);
    }

    Here's the exception stack:
    Additional information: Microsoft.Web.Services2.Security.SecurityFault: The
    security token could not be authenticated or authorized
    at
    Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.OnLogonUserFail
    ed(UsernameToken token)
    at
    Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.LogonUser(Usern
    ameToken token)
    at
    Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.AuthenticateTok
    en(UsernameToken token)
    at
    Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.VerifyToken(Sec
    urityToken securityToken)
    at
    Microsoft.Web.Services2.Security.Tokens.SecurityTo kenManager.LoadXmlSecurity
    Token(XmlElement element)
    at
    Microsoft.Web.Services2.Security.Tokens.SecurityTo kenManager.GetTokenFromXml
    (XmlElement element)
    at Microsoft.Web.Services2.Security.Security.LoadXml( XmlElement element)
    at
    Microsoft.Web.Services2.Security.SecurityInputFilt er.ProcessMessage(SoapEnve
    lope envelope)
    at Microsoft.Web.Services2.Pipeline.ProcessInputMessa ge(SoapEnvelope
    envelope)
    at
    Microsoft.Web.Services2.WebServicesExtension.Befor eDeserializeServer(SoapSer
    verMessage message)

    I can't figure out why Windows Authentication is failing? I've enable tracing on both the input and output. The input shows the correct username and password being passed.

    The account I'm using is a local account and the group is local as well. I can log in locally with that same username/password combination. I've tried using the following for the username ( username and LOCALMACHINE\username). I've even used my domain login and all receive the same error. I've used the RunAs command to launch other applications as this user and that works.

    I also downloaded the Hand-On-Lab (HOLDEVL34: WSE 2.0 Security and Policy) and have tried the supplied "SecureInvoiceA" exercises, but those give the same error as above.

    I'd like to move on to implementing my own UsernameTokenManager, but can concieve of doing so until this simple (so it seems) solution can be made to work.

    Any help is appreciated.
    David M. Young Guest

  2. Similar Questions and Discussions

    1. Invalid Token
      Greetings! I'm new to Dreamweaver. When we try to install the Publish Web Command downloaded from ...
    2. kerberos token
      I get an error when i try: string targetPrincipalName = null; targetPrincipalName = "host/" + System.Net.Dns.GetHostName(); KerberosToken...
    3. IIS UNC Token
      What's the IIS UNC token stated in ASP.NET impersonation docu? How do you set it? Thanks :)
    4. WSE - Username Token
      Hello: I am trying to build a webservice and client that will pass a username and password in the SOAP header. However, when trying to call...
    5. Referenced security token could not be retrieved ERROR
      Hello, I'm getting the error: Referenced security token could not be retrieved What could be wrong? here is the stack trace: ...
  3. #2

    Default Re: WSE 2.0 - The security token could not be authenticated or authori

    Finally got a resolution.

    On Win2k you have to grant "Act as part of operating system" in local
    policies to the ASPNET account for this to work.

    David

    "David M. Young" <DMTDYoung_removethis_@comcast.net> wrote in message
    news:31AF7ED3-241C-499B-A266-5C27A5096F83@microsoft.com...
    > I posted this to
    microsoft.public.dotnet.framework.webservices.enha ncements a few days ago,
    but I'm not getting any helpful responses. I hope someone can help.
    >
    > Here's my code for the Web Service (SimpleWseServer.ServicesMain.asmx)
    > [WebMethod]
    > public string HelloWorld(string username)
    > {
    > SoapContext ctxt = RequestSoapContext.Current;
    > foreach(SecurityToken token in ctxt.Security.Tokens)
    > {
    > if(token is UsernameToken)
    > {
    > UsernameToken user = (UsernameToken)token;
    > if(user.Username==username)
    > {
    > if(user.Principal.IsInRole(System.Net.Dns.GetHostN ame() + @"\Kings"))
    > return "Hello, King " + username;
    > return "Hello, " + username;
    > }
    > }
    > }
    > return "Hello, Liar";
    > }
    >
    > Here the client code (it's a button click event in a WindowsForm)
    > private void btn_login_Click(object sender, System.EventArgs e)
    > {
    > string username = txt_username.Text;
    > string password = txt_password.Text;
    > SimpleWseClient.localhost.ServicesMainWse proxy = new
    > SimpleWseClient.localhost.ServicesMainWse();
    > proxy.Url = "http://localhost/SimpleWseServer/ServicesMain.asmx";
    > proxy.RequestSoapContext.Security.Tokens.Add(new UsernameToken(username,
    > password, PasswordOption.SendPlainText));
    > txt_response.Text = proxy.HelloWorld(username);
    > }
    >
    > Here's the exception stack:
    > Additional information: Microsoft.Web.Services2.Security.SecurityFault:
    The
    > security token could not be authenticated or authorized
    > at
    >
    Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.OnLogonUserFail
    > ed(UsernameToken token)
    > at
    >
    Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.LogonUser(Usern
    > ameToken token)
    > at
    >
    Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.AuthenticateTok
    > en(UsernameToken token)
    > at
    >
    Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.VerifyToken(Sec
    > urityToken securityToken)
    > at
    >
    Microsoft.Web.Services2.Security.Tokens.SecurityTo kenManager.LoadXmlSecurity
    > Token(XmlElement element)
    > at
    >
    Microsoft.Web.Services2.Security.Tokens.SecurityTo kenManager.GetTokenFromXml
    > (XmlElement element)
    > at Microsoft.Web.Services2.Security.Security.LoadXml( XmlElement
    element)
    > at
    >
    Microsoft.Web.Services2.Security.SecurityInputFilt er.ProcessMessage(SoapEnve
    > lope envelope)
    > at Microsoft.Web.Services2.Pipeline.ProcessInputMessa ge(SoapEnvelope
    > envelope)
    > at
    >
    Microsoft.Web.Services2.WebServicesExtension.Befor eDeserializeServer(SoapSer
    > verMessage message)
    >
    > I can't figure out why Windows Authentication is failing? I've enable
    tracing on both the input and output. The input shows the correct username
    and password being passed.
    >
    > The account I'm using is a local account and the group is local as well.
    I can log in locally with that same username/password combination. I've
    tried using the following for the username ( username and
    LOCALMACHINE\username). I've even used my domain login and all receive the
    same error. I've used the RunAs command to launch other applications as
    this user and that works.
    >
    > I also downloaded the Hand-On-Lab (HOLDEVL34: WSE 2.0 Security and Policy)
    and have tried the supplied "SecureInvoiceA" exercises, but those give the
    same error as above.
    >
    > I'd like to move on to implementing my own UsernameTokenManager, but can
    concieve of doing so until this simple (so it seems) solution can be made to
    work.
    >
    > Any help is appreciated.

    dm_dal Guest

  4. #3

    Default Re: WSE 2.0 - The security token could not be authenticated or authori

    And of course you have to restart IIS afterward. Local security
    settings will not take affect (even though it said so) until IIS got
    re-started.

    Pam
    "dm_dal" <REMOVE_THIS.dmy75252@yahoo.com> wrote in message news:<#DCbJt8VEHA.644@tk2msftngp13.phx.gbl>...
    > Finally got a resolution.
    >
    > On Win2k you have to grant "Act as part of operating system" in local
    > policies to the ASPNET account for this to work.
    >
    > David
    >
    > "David M. Young" <DMTDYoung_removethis_@comcast.net> wrote in message
    > news:31AF7ED3-241C-499B-A266-5C27A5096F83@microsoft.com...
    > > I posted this to
    > microsoft.public.dotnet.framework.webservices.enha ncements a few days ago,
    > but I'm not getting any helpful responses. I hope someone can help.
    > >
    > > Here's my code for the Web Service (SimpleWseServer.ServicesMain.asmx)
    > > [WebMethod]
    > > public string HelloWorld(string username)
    > > {
    > > SoapContext ctxt = RequestSoapContext.Current;
    > > foreach(SecurityToken token in ctxt.Security.Tokens)
    > > {
    > > if(token is UsernameToken)
    > > {
    > > UsernameToken user = (UsernameToken)token;
    > > if(user.Username==username)
    > > {
    > > if(user.Principal.IsInRole(System.Net.Dns.GetHostN ame() + @"\Kings"))
    > > return "Hello, King " + username;
    > > return "Hello, " + username;
    > > }
    > > }
    > > }
    > return "Hello, Liar";
    > > }
    > >
    > > Here the client code (it's a button click event in a WindowsForm)
    > > private void btn_login_Click(object sender, System.EventArgs e)
    > > {
    > > string username = txt_username.Text;
    > > string password = txt_password.Text;
    > > SimpleWseClient.localhost.ServicesMainWse proxy = new
    > > SimpleWseClient.localhost.ServicesMainWse();
    > > proxy.Url = "http://localhost/SimpleWseServer/ServicesMain.asmx";
    > > proxy.RequestSoapContext.Security.Tokens.Add(new UsernameToken(username,
    > > password, PasswordOption.SendPlainText));
    > > txt_response.Text = proxy.HelloWorld(username);
    > > }
    > >
    > > Here's the exception stack:
    > > Additional information: Microsoft.Web.Services2.Security.SecurityFault:
    > The
    > > security token could not be authenticated or authorized
    > > at
    > >
    > Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.OnLogonUserFail
    > > ed(UsernameToken token)
    > > at
    > >
    > Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.LogonUser(Usern
    > > ameToken token)
    > > at
    > >
    > Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.AuthenticateTok
    > > en(UsernameToken token)
    > > at
    > >
    > Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.VerifyToken(Sec
    > > urityToken securityToken)
    > > at
    > >
    > Microsoft.Web.Services2.Security.Tokens.SecurityTo kenManager.LoadXmlSecurity
    > > Token(XmlElement element)
    > > at
    > >
    > Microsoft.Web.Services2.Security.Tokens.SecurityTo kenManager.GetTokenFromXml
    > > (XmlElement element)
    > > at Microsoft.Web.Services2.Security.Security.LoadXml( XmlElement
    > element)
    > > at
    > >
    > Microsoft.Web.Services2.Security.SecurityInputFilt er.ProcessMessage(SoapEnve
    > > lope envelope)
    > > at Microsoft.Web.Services2.Pipeline.ProcessInputMessa ge(SoapEnvelope
    > > envelope)
    > > at
    > >
    > Microsoft.Web.Services2.WebServicesExtension.Befor eDeserializeServer(SoapSer
    > > verMessage message)
    > >
    > > I can't figure out why Windows Authentication is failing? I've enable
    > tracing on both the input and output. The input shows the correct username
    > and password being passed.
    > >
    > > The account I'm using is a local account and the group is local as well.
    > I can log in locally with that same username/password combination. I've
    > tried using the following for the username ( username and
    > LOCALMACHINE\username). I've even used my domain login and all receive the
    > same error. I've used the RunAs command to launch other applications as
    > this user and that works.
    > >
    > > I also downloaded the Hand-On-Lab (HOLDEVL34: WSE 2.0 Security and Policy)
    > and have tried the supplied "SecureInvoiceA" exercises, but those give the
    > same error as above.
    > >
    > > I'd like to move on to implementing my own UsernameTokenManager, but can
    > concieve of doing so until this simple (so it seems) solution can be made to
    > work.
    > >
    > > Any help is appreciated.
    P Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139