コード例 #1
0
ファイル: SnippetController.cs プロジェクト: JakubK/SnipCode
        public ActionResult <List <Snippet> > GetUserSnippets([FromHeader] string Authorization)
        {
            string tokenString = Authorization.Split(' ')[1];
            var    handler     = new JwtSecurityTokenHandler();
            var    token       = handler.ReadJwtToken(tokenString) as JwtSecurityToken;
            var    email       = token.Claims.First(claim => claim.Type == ClaimTypes.Email).Value;

            return(_snippetService.GetUserSnippets(email));
        }