Exemple #1
0
        private AtsUserReference CreatePhoneReference(AtsUser user, bool original = false)
        {
            var value = original ? user.OriginalPhoneNumber : user.MobilePhoneNumber;

            if (String.IsNullOrEmpty(value))
            {
                return(null);
            }

            var referenceKey = AtsUserReferenceKey.ForPhoneNumber(user.Tenant, value);

            return(new AtsUserReference(referenceKey, user.ID)
            {
                ETag = "*"
            });
        }
Exemple #2
0
        private AtsUserReference CreateVerificationKeyReference(AtsUser user, bool original = false)
        {
            var value = original ? user.OriginalVerificationKey : user.VerificationKey;

            if (String.IsNullOrEmpty(value))
            {
                return(null);
            }

            var referenceKey = AtsUserReferenceKey.ForVerificationKey(value);

            return(new AtsUserReference(referenceKey, user.ID)
            {
                ETag = "*"
            });
        }
Exemple #3
0
        private AtsUserReference CreateEmailReference(AtsUser user, bool original = false)
        {
            var value = original ? user.OriginalEmail : user.Email;

            if (String.IsNullOrEmpty(value))
            {
                return(null);
            }

            var referenceKey = AtsUserReferenceKey.ForEmail(user.Tenant, value);

            return(new AtsUserReference(referenceKey, user.ID)
            {
                ETag = "*"
            });
        }
Exemple #4
0
        private AtsUser GetUserByReference(AtsUserReferenceKey referenceKey)
        {
            var op = TableOperation.Retrieve <AtsUserReference>(referenceKey.Partition, referenceKey.Row);

            var result = _table.Execute(op);

            if (result.HttpStatusCode != 200)
            {
                return(null);
            }

            var reference = (AtsUserReference)result.Result;

            var userKey = AtsUserKey.ForUserId(reference.UserId);

            op = TableOperation.Retrieve <AtsUser>(userKey.Partition, userKey.Row);

            result = _table.Execute(op);

            return((AtsUser)result.Result);
        }
Exemple #5
0
        public AtsUser GetByLinkedAccount(string tenant, string provider, string id)
        {
            var referenceKey = AtsUserReferenceKey.ForLinkedAccount(tenant, provider, id);

            return(this.GetUserByReference(referenceKey));
        }
Exemple #6
0
        public AtsUser GetByCertificate(string tenant, string thumbprint)
        {
            var referenceKey = AtsUserReferenceKey.ForCertificate(tenant, thumbprint);

            return(this.GetUserByReference(referenceKey));
        }
Exemple #7
0
        public AtsUser GetByVerificationKey(string key)
        {
            var referenceKey = AtsUserReferenceKey.ForVerificationKey(key);

            return(this.GetUserByReference(referenceKey));
        }
Exemple #8
0
        public AtsUser GetByMobilePhone(string tenant, string phone)
        {
            var referenceKey = AtsUserReferenceKey.ForPhoneNumber(tenant, phone);

            return(this.GetUserByReference(referenceKey));
        }
Exemple #9
0
        public AtsUser GetByEmail(string tenant, string email)
        {
            var referenceKey = AtsUserReferenceKey.ForEmail(tenant, email);

            return(this.GetUserByReference(referenceKey));
        }
Exemple #10
0
        public AtsUser GetByUsername(string tenant, string username)
        {
            var referenceKey = AtsUserReferenceKey.ForUsername(tenant, username);

            return(this.GetUserByReference(referenceKey));
        }
 public AtsUserReference(AtsUserReferenceKey keys, Guid id)
 {
     this.PartitionKey = keys.Partition;
     this.RowKey       = keys.Row;
     this.UserId       = id;
 }