Exemplo n.º 1
0
 protected override void ValidateCreateChannelParameters(EndpointAddress remoteAddress, Uri via)
 {
     if (remoteAddress.Identity != null)
     {
         X509CertificateEndpointIdentity identity = remoteAddress.Identity as X509CertificateEndpointIdentity;
         if ((identity != null) && (identity.Certificates.Count > 1))
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("remoteAddress", System.ServiceModel.SR.GetString("HttpsIdentityMultipleCerts", new object[] { remoteAddress.Uri }));
         }
         EndpointIdentity identity2 = remoteAddress.Identity;
         bool             flag      = (((identity != null) || ClaimTypes.Spn.Equals(identity2.IdentityClaim.ClaimType)) || ClaimTypes.Upn.Equals(identity2.IdentityClaim.ClaimType)) || ClaimTypes.Dns.Equals(identity2.IdentityClaim.ClaimType);
         if (!AuthenticationSchemesHelper.IsWindowsAuth(base.AuthenticationScheme) && !flag)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("remoteAddress", System.ServiceModel.SR.GetString("HttpsExplicitIdentity"));
         }
     }
     base.ValidateCreateChannelParameters(remoteAddress, via);
 }
 private T GetIdentityModelProperty <T>()
 {
     if (typeof(T) == typeof(EndpointIdentity))
     {
         if ((this.identity == null) && AuthenticationSchemesHelper.IsWindowsAuth(this.authenticationScheme))
         {
             this.identity = System.ServiceModel.Security.SecurityUtils.CreateWindowsIdentity();
         }
         return((T)this.identity);
     }
     if ((typeof(T) == typeof(ILogonTokenCacheManager)) && (this.userNameTokenAuthenticator != null))
     {
         ILogonTokenCacheManager userNameTokenAuthenticator = this.userNameTokenAuthenticator as ILogonTokenCacheManager;
         if (userNameTokenAuthenticator != null)
         {
             return((T)userNameTokenAuthenticator);
         }
     }
     return(default(T));
 }
 private bool IsAuthSchemeValid(string authType)
 {
     return(AuthenticationSchemesHelper.DoesAuthTypeMatch(this.authenticationScheme, authType));
 }