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))); }
public async Task CreateTeamUsers(IdentityRequestModel teamModel) { var response = await _apiClient.PostAsJsonAsync(_identityUrl, teamModel); response.EnsureSuccessStatusCode(); }