473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Error using WS-Security

Hi Guys

I am getting the following error while implementing authentication using WS-security.

"Microsoft.Web.Services2.Security.SecurityFaul t: The security token could not be authenticated or authorized ---> System.Exception: WSE565: The password provided the SecurityTokenManager does not match the one on the incoming token. at Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.VerifyPlainTextPassword(UsernameToken token, String authenticatedPassword) at Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.VerifyPassword(UsernameToken token, String authenticatedPassword) at Microsoft.Web.Services2.Security.Tokens.UsernameTo kenManager.VerifyToken(SecurityToken securityToken) at Microsoft.Web.Services2.Security.Tokens.SecurityTo kenManager.LoadXmlSecurityToken(XmlElement element) --- End of inner exception stack trace --- at Microsoft.Web.Services2.Security.Tokens.SecurityTo kenManager.LoadXmlSecurityToken(XmlElement element) at Microsoft.Web.Services2.Security.Tokens.SecurityTo kenManager.GetTokenFromXml(XmlElement element) at Microsoft.Web.Services2.Security.Security.LoadToke n(XmlElement element, SecurityConfiguration configuration, Int32& tokenCount) at Microsoft.Web.Services2.Security.Security.LoadXml( XmlElement element) at Microsoft.Web.Services2.Security.SecurityInputFilt er.ProcessMessage(SoapEnvelope envelope) at Microsoft.Web.Services2.Pipeline.ProcessInputMessa ge(SoapEnvelope envelope) at Microsoft.Web.Services2.WebServicesExtension.Befor eDeserializeServer(SoapServerMessage message) "
The class i am using for authentication :
-------------------------------------------------------------------------
using System;
using Microsoft.Web.Services2.Security.Tokens;

namespace WSEAuthService
{

/// <summary>
/// Summary description for AuthUserToken.
/// </summary>

public class AuthUserToken : UsernameTokenManager
{
public AuthUserToken()
{

//// TODO: Add constructor logic here//

}
protected override string AuthenticateToken(UsernameToken token)
{
if(IsblnUserAuthenticated(token.Username,token.Pas sword))
return "Authenticated !! Proceed ....";
else
return "Invalid login....";
}
private bool IsblnUserAuthenticated(string vstrUserId,string vstrPassword)
{
if(vstrUserId=="ashish" && vstrPassword=="gupta")
return true;
else
return false;
}
}

}

--------------------------------------------------------------------------

The web service

---------------------------------------------------------------------------

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using Microsoft.Web.Services2.Security;
using Microsoft.Web.Services2;
using Microsoft.Web.Services2.Security.Tokens;

namespace WSEAuthService
{

/// <summary>

/// Summary description for Service1.

/// </summary>

public class AuthService : System.Web.Services.WebService
{
public AuthUserToken AuthUserTokenObj;
public AuthService()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}

[WebMethod]

public string GetMessage()
{
return "This is my message";
}

}

}
---------------------------------------------------------------------------

Web service client
-----------------------------

UsernameToken UsernameTokenObj=new UsernameToken(txtUserId.Text,txtPassword.Text,Pass wordOption.SendPlainText );

MyWSEServices.AuthServiceWse AuthServiceWseObj=new MyWSEServices.AuthServiceWse();

AuthServiceWseObj.RequestSoapContext.Security.Toke ns.Add(UsernameTokenObj);

lblStatus.Text=AuthServiceWseObj.GetMessage();
------------------------------

Plz help ...
Regards
Ashish

--
Ashish Gupta
Senior Software Executive
Globsyn Technologies
T +91-33-23573610-14
M +91.98314.58752
Nov 18 '05 #1
1 1848
AuthenticateToken(UsernameToken token) should return the actual password, not
any other confirming string (unless that is your password..:-) ). For
implementations where the custom password-check does not actually return the
password, like bool IsPasswdCorrect(string password), you could just return
token.Password if the check returns true.
Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Programatix | last post by:
Hi, I'm working on a project which includes XML WebServices and Windows Form application. The Windows Form application will call the XML WebServices to retrieve data from database. The data...
7
by: Karthik | last post by:
Hello I am trying to convert the following??? The Code std::string* ChkName;
0
by: global | last post by:
Hi, can anyone help me I'm on Linux with UDB Runtime-Client 8.1.4 and try to connect to a windows udb-server 8.1.4 via Websphere and jdbc , and get this error: 3e1a29e5 WebGroup E...
10
by: Sune | last post by:
Hi, previously I used Eclipse CDT for compiling my files just to get started with C and leave C++ behind. Now it's time to get a little more serious so I've moved my files to a new workplace and...
7
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
4
by: Matthew.DelVecchio | last post by:
hello, i am developing an ASP.NET web app that consumes a 3rd party vendor webservice. it is my first one so while ive done my homework, im not an expert on the matter. our partner's...
2
by: rdemyan via AccessMonster.com | last post by:
I'm getting Error 3051 with the following snippet of code. What I'm trying to do is to open an update version on the server (ServerFile) to check it's version number in a front-end...
0
by: Dinesh | last post by:
Hi I treid executing a CICS program in unix. I got an error saying that An unexpected token "UNION " was found following "FF_DT CURRENT DATE". Expected tokens may include: "<space>"....
0
by: dineshsjce | last post by:
I got the following error during precomilation of a cics program under UNIX. " An unexpected token "UNION " was found following "FF_DT > CURRENT DATE". Expected tokens may include: ...
3
by: Tempalli | last post by:
I am exporting the data from ms access to excel where the error displays as Run-time error -2147467259(800004005) Method 'Copyfromrecordset' of object 'Range' faild. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.