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

C# ClaimSet类代码示例

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

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



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

示例1:

		Task<IAccessToken> INonCachingAccessTokenProvider.ProvisionAccessTokenAsync(
			ClaimSet claimSet,	
			IEnumerable<Scope> scopes
		) {
			var @this = this as INonCachingAccessTokenProvider;
			return @this.ProvisionAccessTokenAsync( claimSet.ToClaims(), scopes );
		}
开发者ID:j3parker,项目名称:D2L.Security.OAuth2,代码行数:7,代码来源:AccessTokenProvider.cs


示例2: CreatePolicy

 public override IAuthorizationPolicy CreatePolicy(ClaimSet issuer, SamlSecurityTokenAuthenticator samlAuthenticator)
 {
     if (issuer == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("issuer");
     }
     if (this.policy == null)
     {
         List<ClaimSet> list = new List<ClaimSet>();
         ClaimSet item = this.subject.ExtractSubjectKeyClaimSet(samlAuthenticator);
         if (item != null)
         {
             list.Add(item);
         }
         List<Claim> claims = new List<Claim>();
         ReadOnlyCollection<Claim> onlys = this.subject.ExtractClaims();
         for (int i = 0; i < onlys.Count; i++)
         {
             claims.Add(onlys[i]);
         }
         this.AddClaimsToList(claims);
         list.Add(new DefaultClaimSet(issuer, claims));
         this.policy = new UnconditionalPolicy(this.subject.Identity, list.AsReadOnly(), System.IdentityModel.SecurityUtils.MaxUtcDateTime);
     }
     return this.policy;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:SamlSubjectStatement.cs


示例3:

        bool IClaimSetPrincipal.HasRequiredClaims(ClaimSet requiredClaims)
        {
            // if issuer is null, just check claims from anyone
            // if not, check issuer of claims as well

            return true;
        }
开发者ID:ssickles,项目名称:archive,代码行数:7,代码来源:CustomPrincipal.cs


示例4: UnconditionalPolicy

        public UnconditionalPolicy(ClaimSet issuance, DateTime expirationTime)
        {
            if (issuance == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("issuance");

            Initialize(ClaimSet.System, issuance, null, expirationTime);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:UnconditionalPolicy.cs


示例5: PeerSecurityTraceRecord

 protected PeerSecurityTraceRecord(string meshId, string remoteAddress, ClaimSet claimSet, Exception exception)
 {
     this.meshId = meshId;
     this.remoteAddress = remoteAddress;
     this.claimSet = claimSet;
     this.exception = exception;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:PeerSecurityTraceRecord.cs


示例6: CreatePolicy

        public override IAuthorizationPolicy CreatePolicy(ClaimSet issuer, SamlSecurityTokenAuthenticator samlAuthenticator)
        {
            if (issuer == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("issuer");

            // SupportingTokenAuthenticator collection can be null when the Subject does not
            // contain a key.

            if (this.policy == null)
            {
                List<ClaimSet> claimSets = new List<ClaimSet>();
                ClaimSet subjectKeyClaimset = this.subject.ExtractSubjectKeyClaimSet(samlAuthenticator);
                if (subjectKeyClaimset != null)
                    claimSets.Add(subjectKeyClaimset);

                List<Claim> claims = new List<Claim>();
                ReadOnlyCollection<Claim> subjectClaims = this.subject.ExtractClaims();
                for (int i = 0; i < subjectClaims.Count; ++i)
                {
                    claims.Add(subjectClaims[i]);
                }

                AddClaimsToList(claims);
                claimSets.Add(new DefaultClaimSet(issuer, claims));
                this.policy = new UnconditionalPolicy(this.subject.Identity, claimSets.AsReadOnly(), SecurityUtils.MaxUtcDateTime);
            }

            return this.policy;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:29,代码来源:SamlSubjectStatement.cs


示例7: Initialize

        private void Initialize(ClaimSet issuer, ClaimSet issuance, ReadOnlyCollection<ClaimSet> issuances, DateTime expirationTime)
        {
            _issuer = issuer;
            _issuance = issuance;
            _issuances = issuances;
            _expirationTime = expirationTime;

            // We don't yet support WindowsClaimSet
            //if (issuance != null)
            //{
            //    _disposable = issuance is WindowsClaimSet;
            //}
            //else
            //{
            //    for (int i = 0; i < issuances.Count; ++i)
            //    {
            //        if (issuances[i] is WindowsClaimSet)
            //        {
            //            this.disposable = true;
            //            break;
            //        }
            //    }
            //}

            _disposable = false;
        }
开发者ID:dmetzgar,项目名称:wcf,代码行数:26,代码来源:UnconditionalPolicy.cs


示例8: HasRequiredClaims

        /// <summary>
        /// Has required claims
        /// </summary>
        /// <param name="requiredClaims">Required claim set</param>
        /// <returns><value>True</value> if the issuer has the required claims <value>false</value> if it doesn't</returns>
        public bool HasRequiredClaims(ClaimSet requiredClaims)
        {
            bool hasClaims = true;
           
            // Make sure we have claims to check
            if (this.Claims == null)
            {
                // Token contained no claims, do we need any?
                if (requiredClaims == null || requiredClaims.Count == 0)
                {
                    return true;
                }
                // Deny access
                return false;
            }

            // check issuer
            bool issuerMatch = requiredClaims.Issuer.Any(c => this.Claims.Issuer.ContainsClaim(c));
            
            // check required claims
            if (issuerMatch)
            {
                hasClaims = requiredClaims.All(c => this.Claims.ContainsClaim(c));
            }

            return issuerMatch && hasClaims;
        }
开发者ID:ognjenm,项目名称:egle,代码行数:32,代码来源:ClaimsPrincipal.cs


示例9:

		async Task<IAccessToken> IAccessTokenProvider.ProvisionAccessTokenAsync(
			ClaimSet claimSet,
			IEnumerable<Scope> scopes,
			ICache cache
    ) {
			var @this = this as IAccessTokenProvider;
			return await @this.ProvisionAccessTokenAsync( claimSet.ToClaims(), scopes, cache ).SafeAsync();
		}
开发者ID:j3parker,项目名称:D2L.Security.OAuth2,代码行数:8,代码来源:CachedAccessTokenProvider.cs


示例10: CreditCardTokenAuthorizationPolicy

 public CreditCardTokenAuthorizationPolicy(ClaimSet issuedClaims)
 {
     if (issuedClaims == null)
         throw new ArgumentNullException("issuedClaims");
     this.issuer = issuedClaims.Issuer;
     this.issuedClaimSets = new ClaimSet[] { issuedClaims };
     this.id = Guid.NewGuid().ToString();
 }
开发者ID:cleancodenz,项目名称:ServiceBus,代码行数:8,代码来源:CreditCardTokenAuthorizationPolicy.cs


示例11: CustomAuthorizationPolicy

        public CustomAuthorizationPolicy()
        {
            m_id = Guid.NewGuid();

            Claim c = Claim.CreateNameClaim("http://www.thatindigogirl.com/samples/2006/07/issuer");
            Claim[] claims = new Claim[1];
            claims[0] = c;
            m_issuer = new DefaultClaimSet(claims);
        }
开发者ID:ssickles,项目名称:archive,代码行数:9,代码来源:CustomAuthorizationPolicy.cs


示例12: SecurityTokenAuthorizationPolicy

        internal SecurityTokenAuthorizationPolicy( ClaimSet issuedClaims )
        {
            if ( issuedClaims == null )
                throw new ArgumentNullException( "issuedClaims" );

            _issuer = issuedClaims.Issuer;
            _issuedClaimSets = new[] { issuedClaims };
            _id = Guid.NewGuid().ToString();
        }
开发者ID:Sn3b,项目名称:Omniture-API,代码行数:9,代码来源:SecurityTokenAuthorizationPolicy.cs


示例13: AddClaimSet

        public override void AddClaimSet(IAuthorizationPolicy policy, ClaimSet claimSet)
        {
            if (claimSet == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("claimSet");

            if (_claimSets == null)
                _claimSets = new List<ClaimSet>();

            _claimSets.Add(claimSet);
            ++_generation;
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:11,代码来源:DefaultEvaluationContext.cs


示例14: TryGetStringClaimValue

 bool TryGetStringClaimValue(ClaimSet claimSet, string claimType, out string claimValue)
 {
     claimValue = null;
     IEnumerable<Claim> matchingClaims = claimSet.FindClaims(claimType, Rights.PossessProperty);
     if (matchingClaims == null)
         return false;
     IEnumerator<Claim> enumerator = matchingClaims.GetEnumerator();
     enumerator.MoveNext();
     claimValue = (enumerator.Current.Resource == null) ? null : enumerator.Current.Resource.ToString();
     return true;
 }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:11,代码来源:service.cs


示例15: UnconditionalPolicy

        public UnconditionalPolicy(ClaimSet issuer, ClaimSet issuance, DateTime expirationTime, IList<IIdentity> identities)
        {
            if (issuer == null)
                throw new ArgumentNullException("issuer");
            if (issuance == null)
                throw new ArgumentNullException("issuance");

            this.issuer = issuer;
            this.issuance = issuance;
            this.identities = identities;
            this.expirationTime = expirationTime;
        }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:12,代码来源:MyTokenAuthenticator.cs


示例16: Initialize

 protected void Initialize(ClaimSet issuer, IList<Claim> claims)
 {
     if (issuer == null)
     {
         throw System.IdentityModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("issuer");
     }
     if (claims == null)
     {
         throw System.IdentityModel.DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("claims");
     }
     this.issuer = issuer;
     this.claims = claims;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:DefaultClaimSet.cs


示例17: AddClaimSet

 public override void AddClaimSet(IAuthorizationPolicy policy, ClaimSet claimSet)
 {
     if (claimSet == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("claimSet");
     }
     if (this.claimSets == null)
     {
         this.claimSets = new List<ClaimSet>();
     }
     this.claimSets.Add(claimSet);
     this.generation++;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:DefaultEvaluationContext.cs


示例18: LoadClaims

        protected override void LoadClaims(out ClaimSet issuer, out IList<Claim> claims)
        {
            issuer = _issuer;

            claims = new List<Claim>()
            {
                CreateCustomerClaimId(),
                CreateCustomerClaimProp(),
                CreatePurchaseLimitClaim(),
                CreateLastActivityClaim(),
                CreateStatusClaim(),
            };
        }
开发者ID:calderonsteven,项目名称:Preparation_For_Exam70-513,代码行数:13,代码来源:CustomerClaimSet.cs


示例19: ProvisionAccessTokenAsync_LegacyClaimSetOverload_DoesRightThing

		public async Task ProvisionAccessTokenAsync_LegacyClaimSetOverload_DoesRightThing() {
			var claimSet = new ClaimSet(
				issuer: TestData.ISSUER,
				tenantId: TestData.TENANT_ID,
				user: TestData.USER
			);

			await m_accessTokenProvider
				.ProvisionAccessTokenAsync( claimSet, new Scope[] { } )
				.SafeAsync();

			AssertClaimEquals( m_actualAssertion, Constants.Claims.ISSUER, TestData.ISSUER );
			AssertClaimEquals( m_actualAssertion, Constants.Claims.TENANT_ID, TestData.TENANT_ID.ToString() );
			AssertClaimEquals( m_actualAssertion, Constants.Claims.USER_ID, TestData.USER );
		}
开发者ID:j3parker,项目名称:D2L.Security.OAuth2,代码行数:15,代码来源:AccessTokenProviderTests.cs


示例20: UnconditionalPolicy

 private UnconditionalPolicy(UnconditionalPolicy from)
 {
     _disposable = from._disposable;
     _primaryIdentity = from._disposable ? SecurityUtils.CloneIdentityIfNecessary(from._primaryIdentity) : from._primaryIdentity;
     if (from._issuance != null)
     {
         _issuance = from._disposable ? SecurityUtils.CloneClaimSetIfNecessary(from._issuance) : from._issuance;
     }
     else
     {
         _issuances = from._disposable ? SecurityUtils.CloneClaimSetsIfNecessary(from._issuances) : from._issuances;
     }
     _issuer = from._issuer;
     _expirationTime = from._expirationTime;
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:15,代码来源:UnconditionalPolicy.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ClangParser类代码示例发布时间:2022-05-24
下一篇:
C# Claim类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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