public async Task <bool> RunAsync(string emailAddress)
        {
            HashSet emailAddressHash = await DataProtection.StaticHashAsync(emailAddress, DataKeys.EmailAddressSalt);

            return(await _authenticationDbContext.Identities
                   .AnyAsync(i => i.AuthenticationIdentities.OfType <PasswordIdentity>()
                             .Any(a => a.EmailAddressHash == emailAddressHash.Hash)
                             ));
        }
Example #2
0
        public async Task <Identity> RunAsync(
            AuthenticationGrantTypeClientCredential authenticationGrantTypeClientCredential,
            string identifier)
        {
            HashSet identifierHash = await DataProtection.StaticHashAsync(identifier, DataKeys.IdentifierSalt);

            return(await _authenticationDbContext.Identities
                   .SingleOrDefaultAsync(i =>
                                         i.AuthenticationIdentities.OfType <ClientCredentialIdentity>().Any(a =>
                                                                                                            a.IdentifierHash == identifierHash.Hash &&
                                                                                                            a.AuthenticationGrantTypeClientCredential == authenticationGrantTypeClientCredential)));
        }