1、服务器发送事件(Server-Sent Events(SSE))
2、jjwt
//kxmvP9yXFBZBqbQOhX15Dm4qLKJP4dd/Ast5L5+0hSg= //eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTI0OTc2MDAsInN1YiI6Imh0dHBzOi8vZGphcGkueW9ueW91Y2xvdWQuY29tL2FwaS9vcmRlci92ZXJpZmljYXRpb24vaW5kZXgiLCJyb2xlcyI6IjEiLCJpc3MiOiJhUnBkMnF2R29FWnlWMTZTIiwiaWF0IjoxNDkyNDk3NjAwfQ.MD7vmEh_OHpHwWrspZavnXnWkfGNT5STSQZ8JP37b6w String accessKey="Key"; String accessSecret="秘钥"; String url="地址"; String signKey=buildSignKey(accessKey,accessSecret,getAccessTs(),url); System.out.println(signKey); Map reqParams = new HashMap(); reqParams.put("roles",1); String token=getToken(accessKey,accessSecret,url,reqParams); System.out.println(token); try { Algorithm algorithm = Algorithm.HMAC256(signKey); JWTVerifier verifier = JWT.require(algorithm) .withIssuer(accessKey) .build(); //Reusable verifier instance DecodedJWT jwt = verifier.verify(token); System.out.println(jwt); } catch (UnsupportedEncodingException exception){ //UTF-8 encoding not supported System.out.println(exception); } catch (JWTVerificationException exception){ //Invalid signature/claims System.out.println(exception); }catch (Exception e){ System.out.println(e); }