org.springframework.security.jwt.crypto.sign.InvalidSignatureException Java Examples

The following examples show how to use org.springframework.security.jwt.crypto.sign.InvalidSignatureException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JWTAuthentication.java    From codeway_service with GNU General Public License v3.0 5 votes vote down vote up
public static boolean invalidJwtAccessToken(String authentication) {
	//verifier = Optional.ofNullable(verifier).orElse(new MacSigner(signingKey));
	//是否无效true表示无效
	boolean invalid = Boolean.TRUE;
	try {
		String pubKey = JWTAuthentication.getPubKey(PUBLIC_KEY);
		RsaVerifier rsaVerifier = new RsaVerifier(pubKey);
		Jwt jwt = JwtHelper.decode(authentication);
		jwt.verifySignature(rsaVerifier);
		invalid = Boolean.FALSE;
	} catch (InvalidSignatureException | IllegalArgumentException ex) {
		LogBack.error("user token has expired or signature error");
	}
	return invalid;
}
 
Example #2
Source File: JWTAuthentication.java    From codeway_service with GNU General Public License v3.0 5 votes vote down vote up
public static boolean invalidJwtAccessToken(String authentication) {
	//verifier = Optional.ofNullable(verifier).orElse(new MacSigner(signingKey));
	//是否无效true表示无效
	boolean invalid = Boolean.TRUE;
	try {
		String pubKey = JWTAuthentication.getPubKey(PUBLIC_KEY);
		RsaVerifier rsaVerifier = new RsaVerifier(pubKey);
		Jwt jwt = JwtHelper.decode(authentication);
		jwt.verifySignature(rsaVerifier);
		invalid = Boolean.FALSE;
	} catch (InvalidSignatureException | IllegalArgumentException ex) {
		LogBack.error("user token has expired or signature error");
	}
	return invalid;
}
 
Example #3
Source File: AuthService.java    From JetfireCloud with Apache License 2.0 5 votes vote down vote up
@Override
public boolean invalidJwtAccessToken(String authentication) {
    verifier = Optional.ofNullable(verifier).orElse(new MacSigner(signingKey));
    //是否无效true表示无效
    boolean invalid = Boolean.TRUE;

    try {
        Jwt jwt = getJwt(authentication);
        jwt.verifySignature(verifier);
        invalid = Boolean.FALSE;
    } catch (InvalidSignatureException | IllegalArgumentException ex) {
        log.warn("user token has expired or signature error ");
    }
    return invalid;
}
 
Example #4
Source File: JwtTokenParser.java    From multiapps-controller with Apache License 2.0 5 votes vote down vote up
private void decodeAndVerify(String tokenString) {
    try {
        JwtHelper.decodeAndVerify(tokenString, getSignatureVerifier(getCachedTokenKey()));
    } catch (InvalidSignatureException e) {
        throw new InvalidTokenException(e.getMessage(), e);
    }
}