예제 #1
0
        public async Task <IdentityAdto> GetAsync(GetIdentityAdto getIdentityAdto)
        {
            using (ITransaction transaction = _transactionManager.Create())
            {
                Identity identity = await _identityQueryRepository.GetByIdAsync(getIdentityAdto.Id);

                if (identity == null)
                {
                    throw new BusinessApplicationException(ExceptionType.NotFound, "Identity does not exist");
                }

                transaction.Commit();

                if (identity.HasPassword)
                {
                    return(new PasswordIdentityAdto
                    {
                        Id = identity.Id,
                        Version = ConcurrencyVersionFactory.CreateFromEntity(identity)
                    });
                }

                return(new IdentityAdto
                {
                    Id = identity.Id,
                    Version = ConcurrencyVersionFactory.CreateFromEntity(identity)
                });
            }
        }
예제 #2
0
        public IConcurrencyVersion Get()
        {
            string concurrencyValue = _httpContextAccessor.HttpContext.Request.Headers[ConcurrencyHeaders.IfMatch];

            if (concurrencyValue == null)
            {
                throw new PreConditionFailedException();
            }

            return(ConcurrencyVersionFactory.CreateFromBase64String(concurrencyValue));
        }
 private static GoogleAdto CreateGoogleAdto(AuthenticationGrantTypeGoogle authenticationGrantTypeGoogle)
 {
     return(new GoogleAdto
     {
         Id = authenticationGrantTypeGoogle.Id,
         Name = authenticationGrantTypeGoogle.Name,
         ClientId = authenticationGrantTypeGoogle.MaskedClientId,
         ClientSecret = authenticationGrantTypeGoogle.MaskedClientSecret,
         ClientGrantAccessTokenUrl = authenticationGrantTypeGoogle.ClientGrantAccessTokenUrl,
         GrantAccessTokenUrl = authenticationGrantTypeGoogle.GrantAccessTokenUrl,
         ValidateAccessTokenUrl = authenticationGrantTypeGoogle.ValidateAccessTokenUrl,
         Version = ConcurrencyVersionFactory.CreateFromEntity(authenticationGrantTypeGoogle)
     });
 }
 private static FacebookAdto CreateFacebookAdto(AuthenticationGrantTypeFacebook authenticationGrantTypeFacebook)
 {
     return(new FacebookAdto
     {
         Id = authenticationGrantTypeFacebook.Id,
         Name = authenticationGrantTypeFacebook.Name,
         ClientId = authenticationGrantTypeFacebook.MaskedClientId,
         ClientSecret = authenticationGrantTypeFacebook.MaskedClientSecret,
         ClientGrantAccessTokenUrl = authenticationGrantTypeFacebook.ClientGrantAccessTokenUrl,
         GrantAccessTokenUrl = authenticationGrantTypeFacebook.GrantAccessTokenUrl,
         ValidateAccessTokenUrl = authenticationGrantTypeFacebook.ValidateAccessTokenUrl,
         AppAccessToken = authenticationGrantTypeFacebook.MaskedAppAccessToken,
         Version = ConcurrencyVersionFactory.CreateFromEntity(authenticationGrantTypeFacebook)
     });
 }