public IActionResult RequestToken([FromBody] TokenRequest request)
        {
            if (!_userAuthProvider.CheckUser(request.UserName, request.Password, request.Domain))
            {
                return(BadRequest("Could not verify username and password"));
            }

            var jwt = _tokenHandler.CreateToken(request);

            return(Ok(new
            {
                authToken = jwt
            }));
        }
        public virtual async Task <IHttpActionResult> CreateToken([FromBody] TokenRequest tokenRequest)
        {
            var user = await _auth.AuthenticateUser(tokenRequest.Identity, tokenRequest.Secret);

            if (user == null)
            {
                return(Unauthorized());
            }

            var claims = new Dictionary <string, object>()
            {
                { "identity", user.Identity },
                { "roles", user.Roles }
            };

            return(Ok(await _tokens.CreateToken(claims)));
        }