コード例 #1
0
        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));
        }
コード例 #2
0
        /// <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));
        }