Exemplo n.º 1
0
        public static async Task <string> ConvertAccessTokenJsonResultAsync(this IJWTAuthService authService, string accessToken)
        {
            var result = new JWTResponseToken()
            {
                AccessToken        = accessToken,
                AccessTokenTimeout = JWTContansts.AccessTokenTimeout
            };

            return(await Task.FromResult(JsonConvert.SerializeObject(result)));
        }
Exemplo n.º 2
0
        private static JWTResponseToken GetResponseToken(bool allowRefreshToken, string accessToken, JWTClient client)
        {
            var token = new JWTResponseToken {
                AccessToken         = accessToken,
                AccessTokenTimeout  = JWTContansts.AccessTokenTimeout,
                RefreshTokenTimeout = JWTContansts.RefreshTokenTimeout
            };

            if (allowRefreshToken)
            {
                token.RefreshToken = client.LastRefreshToken;
            }
            return(token);
        }