private IHttpActionResult Handle(GenerateTokenRequest request)
        {
            var claimsIdentity = _claimsIdentityRetriever
                                 .Retrieve(request.UserIdentifier, request.Secret);

            if (claimsIdentity.IsNull())
            {
                throw new UserCredentialsException();
            }

            var response = new GenerateTokenResponse(
                _jwtSecurityTokenGenerator.Generate(claimsIdentity, GetOptions()));

            return(Ok(response));
        }
Example #2
0
        private IHttpActionResult Handle(GenerateTokenRequest request)
        {
            var claimsIdentity = _claimsIdentityRetriever
                .Retrieve(request.UserIdentifier, request.Secret);

            if (claimsIdentity.IsNull())
                throw new UserCredentialsException();

            var response = new GenerateTokenResponse(
                _jwtSecurityTokenGenerator.Generate(claimsIdentity, GetOptions()));

            return Ok(response);
        }
Example #3
0
 private static IHttpActionResult Ok(GenerateTokenResponse response)
 {
     return new OkResult<GenerateTokenResponse>(response);
 }
 private static IHttpActionResult Ok(GenerateTokenResponse response)
 {
     return(new OkResult <GenerateTokenResponse>(response));
 }