public static bool HasVerifyScope(this IIdentity self) { var scopeClaim = self.GetScopeClaim(); return(ScopeEvaluator.ScopeClaimsAllowsActionForSubject(scopeClaim, subject: null, requestedActions: new [] { NuGetScopes.PackageVerify })); }
public void ScopeClaimsAllowsActionForSubjectEvaluatesCorrectly( string scopeClaims, string subject, string[] requestedActions, bool expectedResult) { var result = ScopeEvaluator.ScopeClaimsAllowsActionForSubject( scopeClaims, subject, requestedActions); Assert.Equal(expectedResult, result); }
public static bool HasScopeThatAllowsActionForSubject( this IIdentity self, string subject, string[] requestedActions) { var identity = self as ClaimsIdentity; if (identity == null) { return(false); } var scopeClaim = identity.GetClaimOrDefault(NuGetClaims.Scope); return(ScopeEvaluator.ScopeClaimsAllowsActionForSubject(scopeClaim, subject, requestedActions)); }