• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ServiceModel.EndpointIdentity类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: TryGetIdentity

 public abstract bool TryGetIdentity(EndpointAddress reference, out EndpointIdentity identity);
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:1,代码来源:IdentityVerifier.cs


示例17: CheckAccess

 public abstract bool CheckAccess(EndpointIdentity identity, AuthorizationContext authContext);
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:1,代码来源:IdentityVerifier.cs


示例18: IsMatch

 internal static bool IsMatch(EndpointIdentity identity)
 {
     return (identity.IdentityClaim.ClaimType == "http://schemas.microsoft.com/net/2006/05/peer/peer");
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:PeerIdentityClaim.cs


示例19: FindIdentityClaims

        /// <summary>
        /// Processes the Auth Context to get the IdentityClaims
        /// </summary>
        /// <returns></returns>
        protected void FindIdentityClaims()
        {
            // Pick up the claim type to use for generating the UniqueID claim
            string identificationClaimType = System.Configuration.ConfigurationManager.AppSettings["IdentityClaimType"];

            // Or, default to PPID
            if (string.IsNullOrEmpty(identificationClaimType))
                identificationClaimType = System.IdentityModel.Claims.ClaimTypes.PPID;

            ClaimSet result = null;
            m_endpointIdentity = null;

            foreach (ClaimSet claimSet in m_authorizationContext.ClaimSets)
            {
                //
                // This loops through the claims looking for the configured claim type
                // that will be used as part of the generation of the unique id.
                //
                foreach (Claim claim in claimSet.FindClaims(identificationClaimType, Rights.PossessProperty))
                {
                    // found a matching claim. This is good.
                    m_issuer = CreateIdentityFromClaimSet(claimSet.Issuer);
                    byte[] issuerkey;

                    // we need to get a byte array that represents the issuer's key
                    // to use as part of the hash to generate a unique id. 
                    // currently supported: (byte[]) or an RSACryptoServiceProvider,
                    // This could be expanded to support other types. The key just 
                    // needs to be extracted as a byte array.
                    issuerkey = m_issuer.IdentityClaim.Resource as byte[];
                    if (null == issuerkey)
                    {
                        RSACryptoServiceProvider csp = m_issuer.IdentityClaim.Resource as RSACryptoServiceProvider;
                        if (null != csp)
                            issuerkey = csp.ExportCspBlob(false);

                        // Can't use this claim to get the key.
                        if (null == issuerkey)
                            throw new Exception("Unsupported IdentityClaim resource type");
                    }

                    // It doesn't matter what encoding type we use, as long as it is consistent.
                    // this conversion is just to get a consistent set of bytes from the claim.
                    byte[] uniqueClaim = Encoding.UTF8.GetBytes(GetResourceValue(claim));

                    // copy the thumbprint data and the uniqueClaim together.
                    byte[] thumbprintData = new byte[uniqueClaim.Length + issuerkey.Length];
                    issuerkey.CopyTo(thumbprintData, 0);
                    uniqueClaim.CopyTo(thumbprintData, issuerkey.Length);

                    // generate a hash.
                    using (SHA256 sha = new SHA256Managed())
                    {
                        Claim thumbprintClaim = new Claim(ClaimTypes.Thumbprint, Convert.ToBase64String(sha.ComputeHash(thumbprintData)), Rights.Identity);
                        m_endpointIdentity = EndpointIdentity.CreateIdentity(thumbprintClaim);
                    }

                    m_identityClaims = claimSet;
                    return;
                }


                if (null == m_endpointIdentity)
                {
                    //
                    // check for identity claim, if found, hold on to it, we may need to use it :)
                    //
                    result = claimSet;
                    m_endpointIdentity = CreateIdentityFromClaimSet(claimSet);
                }
            }

            if (null != m_endpointIdentity)
            {
                m_identityClaims = result;
                return;
            }

            //
            // we have looped all claim sets with out finding an identity claim.
            // we will return the ppidIdentity and claimset if they were found.
            //
            throw new Exception("The XML Token data provided no Identity claim.");
        }
开发者ID:ssickles,项目名称:archive,代码行数:88,代码来源:TokenProcessor.cs


示例20: EndpointAddressBuilder

		public EndpointAddressBuilder (EndpointAddress address)
		{
			identity = address.Identity;
			uri = address.Uri;
			foreach (AddressHeader h in address.Headers)
				headers.Add (h);
		}
开发者ID:ItsVeryWindy,项目名称:mono,代码行数:7,代码来源:EndpointAddressBuilder.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ServiceModel.FaultCode类代码示例发布时间:2022-05-26
下一篇:
C# ServiceModel.EndpointAddress类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap