当前位置: 首页>>代码示例>>C#>>正文


C# ServiceModel.EndpointIdentity类代码示例

本文整理汇总了C#中System.ServiceModel.EndpointIdentity的典型用法代码示例。如果您正苦于以下问题:C# EndpointIdentity类的具体用法?C# EndpointIdentity怎么用?C# EndpointIdentity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EndpointIdentity类属于System.ServiceModel命名空间,在下文中一共展示了EndpointIdentity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeFrom

 public void InitializeFrom(EndpointIdentity identity)
 {
     if (identity == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("identity");
     }
     Claim identityClaim = identity.IdentityClaim;
     if (ClaimTypes.Dns.Equals(identityClaim.ClaimType))
     {
         this.Dns.Value = (string) identityClaim.Resource;
     }
     else if (ClaimTypes.Spn.Equals(identityClaim.ClaimType))
     {
         this.ServicePrincipalName.Value = (string) identityClaim.Resource;
     }
     else if (ClaimTypes.Upn.Equals(identityClaim.ClaimType))
     {
         this.UserPrincipalName.Value = (string) identityClaim.Resource;
     }
     else if (ClaimTypes.Rsa.Equals(identityClaim.ClaimType))
     {
         this.Rsa.Value = ((RSA) identityClaim.Resource).ToXmlString(false);
     }
     else if (identity is X509CertificateEndpointIdentity)
     {
         X509Certificate2Collection certificates = ((X509CertificateEndpointIdentity) identity).Certificates;
         this.Certificate.EncodedValue = Convert.ToBase64String(certificates.Export((certificates.Count == 1) ? X509ContentType.SerializedCert : X509ContentType.SerializedStore));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:IdentityElement.cs

示例2: CheckAccess

			public override bool CheckAccess (
				EndpointIdentity identity,
				AuthorizationContext authContext)
			{
				// FIXME: implement
				throw new NotImplementedException ();
			}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:IdentityVerifier.cs

示例3: TryGetIdentity

			public override bool TryGetIdentity (
				EndpointAddress reference,
				out EndpointIdentity identity)
			{
				// FIXME: implement
				throw new NotImplementedException ();
			}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:IdentityVerifier.cs

示例4: CheckAccess

        public override bool CheckAccess(EndpointIdentity identity, System.IdentityModel.Policy.AuthorizationContext authContext)
        {
            bool returnvalue = false;

            foreach (ClaimSet claimset in authContext.ClaimSets)
            {
                foreach (Claim claim in claimset)
                {
                   // if (claim.ClaimType == "http://schemas.microsoft.com/ws/2005/05/identity/claims/x500distinguishedname")
                   // {
                   //     X500DistinguishedName name = (X500DistinguishedName)claim.Resource;
                        //if (name.Name.Contains(((OrgEndpointIdentity)identity).OrganizationClaim))
                       // {
                           // Console.WriteLine("Claim Type: {0}", claim.ClaimType);
                          //  Console.WriteLine("Right: {0}", claim.Right);
                          //  Console.WriteLine("Resource: {0}", claim.Resource);
                          //  Console.WriteLine();
                            returnvalue = true;
                            break;
                    //}
                    //}
                }

            }
            return returnvalue;
        }
开发者ID:cleancodenz,项目名称:ServiceBus,代码行数:26,代码来源:CustomIdentityVerifier.cs

示例5: EndpointAddress

 public EndpointAddress(System.Uri uri, EndpointIdentity identity, params AddressHeader[] addressHeaders)
 {
     if (uri == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("uri");
     }
     this.Init(uri, identity, addressHeaders);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:EndpointAddress.cs

示例6: EndpointIdentityExtension

 public EndpointIdentityExtension(EndpointIdentity identity)
 {
     if (identity == null)
     {
         throw FxTrace.Exception.ArgumentNull("identity");
     }
     this.ClaimType = identity.IdentityClaim.ClaimType;
     this.ClaimRight = identity.IdentityClaim.Right;
     this.ClaimResource = identity.IdentityClaim.Resource;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:EndpointIdentityExtension.cs

示例7: TryGetIdentity

 public override bool TryGetIdentity(EndpointAddress reference, out EndpointIdentity identity)
 {
     if (reference == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("reference");
     }
     identity = reference.Identity;
     if (identity == null)
     {
         identity = new PeerEndpointIdentity();
     }
     return true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:PeerIdentityVerifier.cs

示例8: CheckAccess

		public override bool CheckAccess(EndpointIdentity identity, AuthorizationContext authzContext) {
			List<Claim> dnsClaims = new List<Claim>();
			foreach( ClaimSet claimSet in authzContext.ClaimSets ) {
				foreach( Claim claim in claimSet ) {
					if ( ClaimTypes.Dns == claim.ClaimType ) {
						dnsClaims.Add(claim);
					}
				}
			}
			if ( 1 != dnsClaims.Count ) {
				throw new InvalidOperationException(String.Format("Found {0} DNS claims in authorization context.", dnsClaims.Count));
			}
			return String.Equals((string) this.expectedIdentity.IdentityClaim.Resource, (string) dnsClaims[0].Resource, StringComparison.OrdinalIgnoreCase);
		}
开发者ID:brunobouko,项目名称:eid-trust-service,代码行数:14,代码来源:DnsIdentityVerifier.cs

示例9: EndpointAddress

		public EndpointAddress (
			Uri uri, EndpointIdentity identity,
			AddressHeaderCollection headers,
			XmlDictionaryReader metadataReader,
			XmlDictionaryReader extensionReader)
		{	
			if (uri == null)
				throw new ArgumentNullException ("uri");
			if (!uri.IsAbsoluteUri)
				throw new ArgumentException ("The argument uri must be absolute");
			this.address = uri;
			this.identity = identity;
			this.headers = headers;
			metadata_reader = metadataReader;
			extension_reader = extensionReader;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:16,代码来源:EndpointAddress.cs

示例10: CreateIdentityCheckException

 private Exception CreateIdentityCheckException(EndpointIdentity identity, AuthorizationContext authorizationContext, string errorString, EndpointAddress serviceReference)
 {
     if (((identity.IdentityClaim == null) || !(identity.IdentityClaim.ClaimType == ClaimTypes.Dns)) || (!(identity.IdentityClaim.Right == Rights.PossessProperty) || !(identity.IdentityClaim.Resource is string)))
     {
         return new MessageSecurityException(System.ServiceModel.SR.GetString(errorString, new object[] { identity, serviceReference }));
     }
     string resource = (string) identity.IdentityClaim.Resource;
     string str2 = null;
     for (int i = 0; i < authorizationContext.ClaimSets.Count; i++)
     {
         ClaimSet set = authorizationContext.ClaimSets[i];
         foreach (Claim claim in set.FindClaims(ClaimTypes.Dns, Rights.PossessProperty))
         {
             if (claim.Resource is string)
             {
                 str2 = (string) claim.Resource;
                 break;
             }
         }
         if (str2 != null)
         {
             break;
         }
     }
     if ("IdentityCheckFailedForIncomingMessage".Equals(errorString))
     {
         if (str2 == null)
         {
             return new MessageSecurityException(System.ServiceModel.SR.GetString("DnsIdentityCheckFailedForIncomingMessageLackOfDnsClaim", new object[] { resource }));
         }
         return new MessageSecurityException(System.ServiceModel.SR.GetString("DnsIdentityCheckFailedForIncomingMessage", new object[] { resource, str2 }));
     }
     if ("IdentityCheckFailedForOutgoingMessage".Equals(errorString))
     {
         if (str2 == null)
         {
             return new MessageSecurityException(System.ServiceModel.SR.GetString("DnsIdentityCheckFailedForOutgoingMessageLackOfDnsClaim", new object[] { resource }));
         }
         return new MessageSecurityException(System.ServiceModel.SR.GetString("DnsIdentityCheckFailedForOutgoingMessage", new object[] { resource, str2 }));
     }
     return new MessageSecurityException(System.ServiceModel.SR.GetString(errorString, new object[] { identity, serviceReference }));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:42,代码来源:IdentityVerifier.cs

示例11: CheckAccess

        // Code to be added.
        public override bool CheckAccess(EndpointIdentity identity, AuthorizationContext authContext)
        {
            StreamWriter file = new StreamWriter("c:\\temp\\TestClient.CustomIdentityVerifier - CheckAccess.txt", true);
            file.WriteLine("_________________________________________");
            file.WriteLine("DateTime: " + DateTime.Now.ToString());

            bool returnvalue = false;

            foreach (ClaimSet claimset in authContext.ClaimSets)
            {
                foreach (Claim claim in claimset)
                {
                    file.WriteLine("claim.ClaimType: " + claim.ClaimType);
                    file.WriteLine("\tclaim.Right: " + claim.Right);
                    file.WriteLine("\t\tclaim.Resource: " + claim.Resource.ToString());

                    if (claim.ClaimType == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/x500distinguishedname")
                    {
                        X500DistinguishedName name = (X500DistinguishedName)claim.Resource;
                        file.WriteLine("X500DistinguishedName: " + name.Name);

                        //if (name.Name.Contains(((OrgEndpointIdentity)identity).OrganizationClaim))
                        //if ("CN=zpatlittrs239.ittl.gtri.org" == name.Name)
                        if ("[email protected], CN=HA50WSP, O=Hawaii Five0, L=Honolulu, S=Hawaii, C=US" == name.Name)
                        {
                            file.WriteLine("\tClaim Type: {0}", claim.ClaimType);
                            file.WriteLine("\tRight: {0}", claim.Right);
                            file.WriteLine("\tResource: {0}", claim.Resource);
                            file.WriteLine();
                            returnvalue = true;
                        }
                    }
                }

            }

            file.Close();

            return returnvalue;
        }
开发者ID:gtkrug,项目名称:gfipm-ws-ms.net,代码行数:41,代码来源:CustomIdentityVerifier.cs

示例12: ClousotWCFServiceCommon

    static ClousotWCFServiceCommon()
    {
      Identity = new DnsEndpointIdentity("research.microsoft.com"); // Used by the client to be sure that we are who we say we are

#if DEBUG
      SecurityMode = SecurityMode.None;  // Mehdi: "Very complex things", we ignore them
#else
      SecurityMode = SecurityMode.None; // TODO
#endif

#if WS_HTTP_BINDING
#if DEBUG
      // This address does not need administrator privilege
      // Namespace created during the installation of Visual Studio
      BaseAddress = "http://localhost:8732/Design_Time_Addresses/ClousotService/";
#else
      // Need administrator privilege
      BaseAddress = "http://localhost:8732/Microsoft.Research/ClousotService/";
#endif
#elif NET_TCP_BINDING
      BaseAddress = "net.tcp://localhost:9922/ClousotService/";
#endif
      BaseUri = new Uri(BaseAddress);
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:24,代码来源:ClousotServiceCommon.cs

示例13: CreateIdentityCheckException

        Exception CreateIdentityCheckException(EndpointIdentity identity, AuthorizationContext authorizationContext, string errorString, EndpointAddress serviceReference)
        {
            Exception result;

            if (identity.IdentityClaim != null
                && identity.IdentityClaim.ClaimType == ClaimTypes.Dns
                && identity.IdentityClaim.Right == Rights.PossessProperty
                && identity.IdentityClaim.Resource is string)
            {
                string expectedDnsName = (string)identity.IdentityClaim.Resource;
                string actualDnsName = null;
                for (int i = 0; i < authorizationContext.ClaimSets.Count; ++i)
                {
                    ClaimSet claimSet = authorizationContext.ClaimSets[i];
                    foreach (Claim claim in claimSet.FindClaims(ClaimTypes.Dns, Rights.PossessProperty))
                    {
                        if (claim.Resource is string)
                        {
                            actualDnsName = (string)claim.Resource;
                            break;
                        }
                    }
                    if (actualDnsName != null)
                    {
                        break;
                    }
                }
                if (SR.IdentityCheckFailedForIncomingMessage.Equals(errorString))
                {
                    if (actualDnsName == null)
                    {
                        result = new MessageSecurityException(SR.GetString(SR.DnsIdentityCheckFailedForIncomingMessageLackOfDnsClaim, expectedDnsName));
                    }
                    else
                    {
                        result = new MessageSecurityException(SR.GetString(SR.DnsIdentityCheckFailedForIncomingMessage, expectedDnsName, actualDnsName));
                    }
                }
                else if (SR.IdentityCheckFailedForOutgoingMessage.Equals(errorString))
                {
                    if (actualDnsName == null)
                    {
                        result = new MessageSecurityException(SR.GetString(SR.DnsIdentityCheckFailedForOutgoingMessageLackOfDnsClaim, expectedDnsName));
                    }
                    else
                    {
                        result = new MessageSecurityException(SR.GetString(SR.DnsIdentityCheckFailedForOutgoingMessage, expectedDnsName, actualDnsName));
                    }
                }
                else
                {
                    result = new MessageSecurityException(SR.GetString(errorString, identity, serviceReference));
                }
            }
            else
            {
                result = new MessageSecurityException(SR.GetString(errorString, identity, serviceReference));
            }

            return result;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:61,代码来源:IdentityVerifier.cs

示例14: CheckAccess

        public override bool CheckAccess(EndpointIdentity identity, AuthorizationContext authContext)
        {
            bool returnvalue = false;

            foreach (ClaimSet claimset in authContext.ClaimSets)
            {
                foreach (Claim claim in claimset)
                {
                    if (claim.ClaimType == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/x500distinguishedname")
                    {
                        X500DistinguishedName name = (X500DistinguishedName)claim.Resource;
                        if (name.Name.Contains(((OrgEndpointIdentity)identity).OrganizationClaim))
                        {
                            Console.WriteLine("Claim Type: {0}", claim.ClaimType);
                            Console.WriteLine("Right: {0}", claim.Right);
                            Console.WriteLine("Resource: {0}", claim.Resource);
                            Console.WriteLine();
                            returnvalue = true;
                        }
                    }
                }

            }
            return returnvalue;
        }
开发者ID:ssickles,项目名称:archive,代码行数:25,代码来源:client.cs

示例15: TryGetIdentity

 public override bool TryGetIdentity(EndpointAddress reference, out EndpointIdentity identity)
 {
     return IdentityVerifier.CreateDefault().TryGetIdentity(reference, out identity);
 }
开发者ID:ssickles,项目名称:archive,代码行数:4,代码来源:client.cs


注:本文中的System.ServiceModel.EndpointIdentity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。