/// <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; }