Example #1
0
        public ActionResult GetToken([FromBody] IdentityRequestModel model)
        {
            if (model.UserName != "user" || model.Password != "1234")
            {
                throw new NotFoundException("Not Found User");
            }

            var tokenHandler = new JwtSecurityTokenHandler();
            var signingKey   = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(_settings.Value.SecretKey));
            var jwt          = new JwtSecurityToken(
                issuer: _settings.Value.Iss,
                audience: _settings.Value.Aud,
                expires: DateTime.UtcNow.AddDays(1),
                signingCredentials: new SigningCredentials(signingKey, SecurityAlgorithms.HmacSha256)
                );
            var encodedJwt = new JwtSecurityTokenHandler().WriteToken(jwt);

            return(Ok(new IdentityResponseModel(encodedJwt)));
        }
Example #2
0
        public async Task CreateTeamUsers(IdentityRequestModel teamModel)
        {
            var response = await _apiClient.PostAsJsonAsync(_identityUrl, teamModel);

            response.EnsureSuccessStatusCode();
        }