English 中文(简体)
• 如何使用从ASMX网络服务处获得的WS-安全和用户名称?
原标题:How to use WS-Security and Access UsernameToken from an ASMX Web Service?

Okay,因此,我们拥有一个“AMX”网络功能,目前运行在NET3.5,我们重新使用2008年视觉演播室。

问题是,我们需要增加认证,并且希望利用WS-安全模式,而不要打破目前不需要认证的任何内部客户。

我们思考的是,增加习俗头脑,但这并非是核武器国家的安全。 而且,从长远来看,提升到周转基金还不可行。

用户名Token(前提是客户通过)是否间接进入VS2008年SMX网络服务的跳板?

最佳回答

您可尝试Web Services Advancements 3.0。 这为“世界安全论坛”的“old版本”提供了支持(我认为,2004年版本“世界安全论坛”支持2005年和2007年版本)。 它坐在亚数据和元数据交换的顶端,并不令人不安,它仍在“NET”3.5 /WS2008中工作。

现在是下游:

  • VS2008 does not support adding or updating WSE-enabled web references in client code. It will happily create the normal ASMX proxy class, but not the extra WSE proxy class that is required for authentication. Any existing WSE proxy code you have does compile OK, but will be deleted if you try to update the web reference in the IDE. If you possess a copy of VS2005, you could use it to maintain or at least create the web reference on the client side.
  • AFAIK, the WSE implementation of WS-Security is not 100% forward-compatible with the WCF implementations. You will need to do some compatibility testing of your own with WCF to make sure.

<><>Example>

客户资格:

void SetUsernameCredential(WebServicesClientProtocol service, string userName, string password) {
    UsernameToken token = new UsernameToken(userName, password, PasswordOption.SendHashed);
    service.SetClientCredential(token);
}

服务器上的认证证书:

public class MyUsernameTokenManager : UsernameTokenManager {
    protected override string AuthenticateToken(UsernameToken token) {
        // Authenticate here.
        // If succeess, return an authenticated IPrincipal and the user s password as shown.
        // If failure, throw an exception of your choosing.
        token.Principal = principal;
        return password;
    }
}

在服务器上读取证书:

IPrincipal principal = RequestSoapContext.Current.IdentityToken.Principal;
问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签