Exemple #1
0
        public async Task <IdentityResult> Create(CredentialsModelBL credentials)
        {
            var userIdentity   = mapper.Map <ApplicationUser>(credentials);
            var identityResult = await userManager.CreateAsync(userIdentity, credentials.Password);

            return(identityResult);
        }
Exemple #2
0
        public async Task <string> GetJwtForCredentials(CredentialsModelBL credentials)
        {
            var identity = await GetClaimsIdentity(credentials.Username, credentials.Password);

            if (identity == null)
            {
                return(null);
            }

            return(await Tokens.GenerateJwt(
                       identity,
                       jwtFactory,
                       credentials.Username,
                       jwtOptions,
                       new JsonSerializerSettings { Formatting = Formatting.Indented }
                       ));
        }