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

The following examples show how to use org.springframework.security.jwt.crypto.sign.MacSigner. 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: 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 #2
Source File: HelperFilterConfig.java    From gateway-helper with Apache License 2.0 4 votes vote down vote up
@Bean
public Signer jwtSigner(HelperProperties helperProperties) {
    return new MacSigner(helperProperties.getJwtKey());
}
 
Example #3
Source File: CustomZuulConfig.java    From api-gateway-old with Apache License 2.0 4 votes vote down vote up
@Bean
public Signer jwtSigner(GatewayProperties gatewayHelperProperties) {
    return new MacSigner(gatewayHelperProperties.getJwtKey());
}
 
Example #4
Source File: OAuth2ResourceServer.java    From OAuth-2.0-Cookbook with MIT License 4 votes vote down vote up
@Bean
public SignatureVerifier verifier() {
    return new MacSigner("non-prod");
}