コード例 #1
0
        public string GetAccessToken(string refreshToken)
        {
            var jwtPayload  = _jwtService.GetJwtPayload(refreshToken);
            var accessToken = _accessTokenService.CreateToken(jwtPayload.userEmail);

            return(accessToken);
        }
コード例 #2
0
        public void Encode_And_Validate_JwToken()
        {
            var accessToken = _accessTokenService.CreateToken("*****@*****.**");

            var isValid = _jwtService.IsSignatureValid(accessToken);

            Assert.IsTrue(isValid);
        }
コード例 #3
0
        public IActionResult CreateAccessToken(AccessTokenCreateModel tokenCreate)
        {
            if (string.IsNullOrEmpty(tokenCreate.TokenType))
            {
                throw new Exception("Invalid TokenType");
            }
            if (tokenCreate.HoursAllowed < 1)
            {
                throw new Exception("Cannot have Hours Allowed less than 1");
            }
            _accessTokenService.CreateToken(tokenCreate.HoursAllowed, tokenCreate.TokenType);

            return(RedirectToAction("List"));
        }