473,549 Members | 3,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error using WS-Security

Hi Guys

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

"Microsoft.Web. Services2.Secur ity.SecurityFau lt: The security token could
not be authenticated or authorized ---> System.Exceptio n: WSE565: The
password provided the SecurityTokenMa nager does not match the one on the
incoming token. at
Microsoft.Web.S ervices2.Securi ty.Tokens.Usern ameTokenManager .VerifyPlainTex t
Password(Userna meToken token, String authenticatedPa ssword) at
Microsoft.Web.S ervices2.Securi ty.Tokens.Usern ameTokenManager .VerifyPassword (
UsernameToken token, String authenticatedPa ssword) at
Microsoft.Web.S ervices2.Securi ty.Tokens.Usern ameTokenManager .VerifyToken(Se c
urityToken securityToken) at
Microsoft.Web.S ervices2.Securi ty.Tokens.Secur ityTokenManager .LoadXmlSecurit y
Token(XmlElemen t element) --- End of inner exception stack trace --- at
Microsoft.Web.S ervices2.Securi ty.Tokens.Secur ityTokenManager .LoadXmlSecurit y
Token(XmlElemen t element) at
Microsoft.Web.S ervices2.Securi ty.Tokens.Secur ityTokenManager .GetTokenFromXm l
(XmlElement element) at
Microsoft.Web.S ervices2.Securi ty.Security.Loa dToken(XmlEleme nt element,
SecurityConfigu ration configuration, Int32& tokenCount) at
Microsoft.Web.S ervices2.Securi ty.Security.Loa dXml(XmlElement element) at
Microsoft.Web.S ervices2.Securi ty.SecurityInpu tFilter.Process Message(SoapEnv e
lope envelope) at
Microsoft.Web.S ervices2.Pipeli ne.ProcessInput Message(SoapEnv elope envelope)
at
Microsoft.Web.S ervices2.WebSer vicesExtension. BeforeDeseriali zeServer(SoapSe r
verMessage message) "
The class i am using for authentication :
-------------------------------------------------------------------------
using System;
using Microsoft.Web.S ervices2.Securi ty.Tokens;

namespace WSEAuthService
{

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

public class AuthUserToken : UsernameTokenMa nager
{
public AuthUserToken()
{

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

}
protected override string AuthenticateTok en(UsernameToke n token)
{
if(IsblnUserAut henticated(toke n.Username,toke n.Password))
return "Authentica ted !! Proceed ....";
else
return "Invalid login....";
}
private bool IsblnUserAuthen ticated(string vstrUserId,stri ng vstrPassword)
{
if(vstrUserId== "ashish" && vstrPassword==" gupta")
return true;
else
return false;
}
}

}

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

The web service

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

using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Data;
using System.Diagnost ics;
using System.Web;
using System.Web.Serv ices;
using Microsoft.Web.S ervices2.Securi ty;
using Microsoft.Web.S ervices2;
using Microsoft.Web.S ervices2.Securi ty.Tokens;

namespace WSEAuthService
{

/// <summary>

/// Summary description for Service1.

/// </summary>

public class AuthService : System.Web.Serv ices.WebService
{
public AuthUserToken AuthUserTokenOb j;
public AuthService()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeCompo nent();
}

[WebMethod]

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

}

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

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

UsernameToken UsernameTokenOb j=new
UsernameToken(t xtUserId.Text,t xtPassword.Text ,PasswordOption .SendPlainText )
;

MyWSEServices.A uthServiceWse AuthServiceWseO bj=new
MyWSEServices.A uthServiceWse() ;

AuthServiceWseO bj.RequestSoapC ontext.Security .Tokens.Add(Use rnameTokenObj);

lblStatus.Text= AuthServiceWseO bj.GetMessage() ;
------------------------------

Plz help ...
Regards
Ashish

Nov 16 '05 #1
4 7968
Isn't AuthenticateTok en supposed to return the password? (Not some
random string.)

I can't reference a URL or document, but it seems to ring a bell off the
top of my head. It's also how my custom UsernameTokenMa nager is configured.

-Ben

protected override string AuthenticateTok en(UsernameToke n token)
{
if(IsblnUserAut henticated(toke n.Username,toke n.Password))
return "Authentica ted !! Proceed ....";
else
return "Invalid login....";
}

--
to reply, remove .s.p.a.m. from email
Nov 16 '05 #2
Yes, AuthenticateTok en must return the user's password. If the password
returned by this method doesn't match the password contained in the
token, the authentication fails.

Nov 16 '05 #3


protected override string AuthenticateTok en(UsernameToke n token)
{
if(IsblnUserAut henticated(toke n.Username,toke n.Password))
return "Authentica ted !! Proceed ....";
else
return "Invalid login....";
}


So how to modify the above method so tht i can implement authentication
with WS-Security?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #4
ashish gupta wrote:

protected override string AuthenticateTok en(UsernameToke n token)
{
if(IsblnUserA uthenticated(to ken.Username,to ken.Password))
return "Authentica ted !! Proceed ....";
else
return "Invalid login....";
}

So how to modify the above method so tht i can implement authentication
with WS-Security?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


I guess something like this:

protected override string AuthenticateTok en(UsernameToke n token)
{
if (IsblnUserAuthe nticated(token. Username, token.Password) )
return token.Password;
else
return "Invalid";
}

--
to reply, remove .s.p.a.m. from email
Nov 16 '05 #5

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

Similar topics

8
2381
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 will be returned as DataSet. Now, here's the problem. On .NET Framework 1.1, if any rows in the dataset returned contain errors (marked by calling...
7
10256
by: Karthik | last post by:
Hello I am trying to convert the following??? The Code std::string* ChkName;
0
1964
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 SRVE0026E: -: java.lang.UnsatisfiedLinkError: SQLConnect at COM.ibm.db2.jdbc.app.DB2Connection.connect(DB2Connection.java:514) at...
10
2335
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 begun to use GNU Autotools. I'm sorry to say I'm new to gcc as well :( Now I get the most ridiculous compile error which I'm unable to solve....
7
3076
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 works fine. So I deploy the webservice on a remote machine (Linux box) and I get an error when calling the service. BUT: I can retrieve the WSDL and...
4
20474
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 webservice operates on SSL via an "https://" url. they also gave me a .PFX certificate which ive installed via window's MMC utility, into the "Computer...
2
5742
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 table(VersionRef) and compare it with the version number of the LocalFile which has the same front-end table. WorkgroupFileName is determined elsewhere. ...
0
1359
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>". SQLSTATE=42601 Can anybody please help me in solving this problem ? This is the piece of code whare I am getting error.
0
6064
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: "<space>". SQLSTATE=42601 " The following is the piece of code where I am facing the problem. SELECT 'Y' INTO :WS-FUTURE-EXIST-SW
3
2529
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. Ws.Range("A2").CopyFromRecordset rs One of my Field Name, DATATYPE is set to MEMO I am testing with DATATYPE As TEXT and the Characters within 255 then the report...
0
7560
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7758
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7844
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6098
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5401
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1978
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1093
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
800
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.