private static bool HasBooleanClaim(IPrincipal self, string claimType) { if (self == null || self.Identity == null) { return(false); } var identity = self.Identity as ClaimsIdentity; return(ClaimsExtensions.HasBooleanClaim(identity, claimType)); }
/// <summary> /// Determine if the current user has an associated password credential. /// </summary> /// <param name="self">Current user principal.</param> /// <returns>True if user has password credential, false otherwise.</returns> public static bool HasPasswordLogin(this IPrincipal self) { if (self == null || self.Identity == null) { return(false); } var identity = self.Identity as ClaimsIdentity; return(ClaimsExtensions.HasBooleanClaim(identity, NuGetClaims.PasswordLogin)); }