Java 类io.jsonwebtoken.ClaimJwtException 实例源码

项目:ARCLib    文件:JwtTokenProvider.java   
@Override
public JwtToken authenticate(Authentication authentication) throws AuthenticationException {

    JwtToken token = (JwtToken) authentication;

    if (token.getPrincipal() instanceof String) {

        try {
            Claims claims = Jwts.parser()
                    .setSigningKey(secret)
                    .parseClaimsJws((String) token.getPrincipal())
                    .getBody();

            UserDetails user = handler.parseClaims(claims);

            return new JwtToken(user, claims, user.getAuthorities());
        } catch (ClaimJwtException ex) {
            throw new BadCredentialsException("JWT error", ex);
        }
    } else {
        return null;
    }
}
项目:apiman-plugins    文件:PolicyFailureFactory.java   
public PolicyFailure invalidClaim(IPolicyContext context, ClaimJwtException e) {
    return createAuthenticationPolicyFailure(context, AUTH_JWT_CLAIM_FAILURE,
            e.getLocalizedMessage());
}