Rem*_*mko 11 .net c# authentication httpwebrequest
我正在实现一些与使用RFC2617扩展的Web服务器对话的代码.为了实现这一点,我实现了一个IAuthenticationManager模块.
我的身份验证模块检查收到的质询是否适用于MyAuth:
public Authorization Authenticate(String challenge, WebRequest request, ICredentials credentials)
{
if (!challenge.Contains(AuthenticationType)) // MyAuth
{
{
return null;
}
}
...
// Get the token, omitted here
return authorization;
Run Code Online (Sandbox Code Playgroud)
然后我打电话 AuthenticationManager.Register(MyAuthModule);
当WebRequest有UseIntegrated.UseDefaultCredentials = true或请求已添加凭据时,WebRequest.Credentials我的身份验证模块被调用,一切正常.但是,如果WebRequest没有凭据且未使用默认凭据,则不会调用我的授权模块,并且请求失败.
如何在收到质询但WebRequest没有凭据且未使用默认凭据时确保调用我的身份验证模块?
| 归档时间: |
|
| 查看次数: |
294 次 |
| 最近记录: |