Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / August 2004

Tip: Looking for answers? Try searching our database.

Custom UsernameTokenManager

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ben Bloom - 02 Aug 2004 19:15 GMT
I'm trying to implement a custom username token manager, with little
success.

My service and client both have WSE2 enabled.  This is an ASMX web
service. Authentication works without the custom token, sending password
in PlainText.

As soon as I change it to send a hashed password, and enable
MyUsernameTokenManager, it gives me the following error:

Additional information:
System.Web.Services.Protocols.SoapHeaderException: Server unavailable,
please try later ---> System.Configuration.ConfigurationException:
WSE032: There was an error loading the microsoft.web.services2
configuration section. ---> System.Configuration.ConfigurationException:
WSE040: Type Macgregor.Mambo.PrimeBroker.MyUsernameTokenManager,
Macgregor.Mambo.PrimeBroker could not be loaded. Please check the
configuration file.
   at System.Web.Configuration.HttpConfigurationRecord.Evaluate(String
configKey, SectionRecord section)
   at System.Web.Configuration.HttpConfigurationRecord.GetConfig(String
configKey, Boolean cacheResult)
   at System.Web.Configuration.HttpConfigurationRecord.GetConfig(String
configKey, Boolean cacheResult)
   at System.Web.HttpContext.GetConfig(String name)
   at
System.Web.Configuration.HttpConfigurationSystemBase.System.Configuration.IConfigurationSystem.GetConfig(String
configKey)
   at System.Configuration.ConfigurationSettings.GetConfig(String
sectionName)
   at
Microsoft.Web.Services2.Configuration.WebServicesConfiguration.Initialize()
   --- End of inner exception stack trace ---
   at
Microsoft.Web.Services2.Configuration.WebServicesConfiguration.Initialize()
   at Microsoft.Web.Services2.Pipeline..ctor()
   at
Microsoft.Web.Services2.WebServicesExtension.BeforeDeserializeServer(SoapServerMessage
message)
   --- End of inner exception stack trace ---

I have my username token manager defined as follows:

public class MyUsernameTokenManager : UsernameTokenManager
    {
        protected override string AuthenticateToken(UsernameToken token)
        {   
            return "password";  //for dev only.. logic to come later.
        }
    }

My web.config file looks like this:

<security>
      <securityTokenManager
type="Macgregor.Mambo.PrimeBroker.MyUsernameTokenManager,
Macgregor.Mambo.PrimeBroker"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
qname="wsse:UsernameToken" />
    </security>

I'm a little confused about the syntax of the type attribute.  Why is it
namespace.class, namespace?  (I took this syntax from the HOL.)

Why can't my web service load MyUsernameTokenManager?

Thanks.

-Ben
SA - 03 Aug 2004 12:52 GMT
Ben:

It's not

namespace.class, namespace

but rather,

namespace.class, assemblyname

That should fix your problem with the web.config. I think the rest of your
config looks OK. Code should be find too.

Signature

Sven

> I'm trying to implement a custom username token manager, with little
> success.
[quoted text clipped - 22 lines]
>     at System.Web.HttpContext.GetConfig(String name)
>     at

System.Web.Configuration.HttpConfigurationSystemBase.System.Configuration.IC
onfigurationSystem.GetConfig(String
> configKey)
>     at System.Configuration.ConfigurationSettings.GetConfig(String
> sectionName)
>     at

Microsoft.Web.Services2.Configuration.WebServicesConfiguration.Initialize()
>     --- End of inner exception stack trace ---
>     at

Microsoft.Web.Services2.Configuration.WebServicesConfiguration.Initialize()
>     at Microsoft.Web.Services2.Pipeline..ctor()
>     at

Microsoft.Web.Services2.WebServicesExtension.BeforeDeserializeServer(SoapSer
verMessage
> message)
>     --- End of inner exception stack trace ---
[quoted text clipped - 15 lines]
> type="Macgregor.Mambo.PrimeBroker.MyUsernameTokenManager,
> Macgregor.Mambo.PrimeBroker"

xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecuri
ty-secext-1.0.xsd"
> qname="wsse:UsernameToken" />
>      </security>
[quoted text clipped - 7 lines]
>
> -Ben
Ben Bloom - 03 Aug 2004 12:59 GMT
Ooooh.  Yeah, that might make a difference.  I'll give that a shot.  Thanks!

> Ben:
>
[quoted text clipped - 8 lines]
> That should fix your problem with the web.config. I think the rest of your
> config looks OK. Code should be find too.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.