示例#1
0
 public static AuthorizationPolicyBuilder RequireScope(
     this AuthorizationPolicyBuilder authorizationPolicyBuilder,
     string requiredScope)
 {
     authorizationPolicyBuilder.RequireScopes(NonEmptyList.Create(requiredScope));
     return(authorizationPolicyBuilder);
 }
示例#2
0
        public void MultiScopeRegistrationTest()
        {
            const string openIdScope  = "openid";
            const string profileScope = "profile";
            var          builder      = new AuthorizationPolicyBuilder();

            builder.RequireScopes(NonEmptyList.Create(openIdScope, profileScope));
            var requiredScopes = ((ScopeAuthorizationRequirement)builder.Requirements.ToList()[0]).RequiredScopes.ToList();

            Assert.Contains(openIdScope, requiredScopes);
            Assert.Contains(profileScope, requiredScopes);
        }