public ActionResult <IdTokenDTO> GetUser() { try { var token = jwtProvider.IdToken(HttpContext); return(Ok(new IdTokenDTO { IdToken = token })); } catch (LeafAuthenticationException lae) { logger.LogError("User is not authorized to use Leaf. Error:{Error}", lae.Message); return(StatusCode(StatusCodes.Status403Forbidden)); } catch (Exception e) { logger.LogError("Could not produce identity token. Error:{Error}", e.ToString()); return(StatusCode(StatusCodes.Status500InternalServerError)); } }
public async Task <ActionResult <IdTokenDTO> > GetUser() { try { var login = await jwtProvider.IdToken(HttpContext); return(Ok(new IdTokenDTO { IdToken = login })); } catch (LeafAuthenticationException lae) { logger.LogError("User is not authorized to use Leaf. Error:{Error} User:{user}", lae.Message, HttpContext.User); return(StatusCode(StatusCodes.Status403Forbidden)); } catch (Exception e) { logger.LogError("Failed to produce identity token. Error:{Error}", e.ToString()); return(StatusCode(StatusCodes.Status500InternalServerError)); } }