All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mastercard.developer.interceptors.OpenFeignJweDecoder Maven / Gradle / Ivy

There is a newer version: 1.8.3
Show newest version
package com.mastercard.developer.interceptors;

import com.mastercard.developer.encryption.EncryptionConfig;
import com.mastercard.developer.encryption.EncryptionException;
import com.mastercard.developer.encryption.JweConfig;
import com.mastercard.developer.encryption.JweEncryption;
import feign.Response;
import feign.codec.Decoder;

/**
 * A Feign JWE decoder for decrypting parts of HTTP payloads.
 */
public class OpenFeignJweDecoder extends OpenFeignDecoderExecutor {

    private final JweConfig config;

    public OpenFeignJweDecoder(EncryptionConfig config, Decoder delegate) {
        super(delegate);
        this.config = (JweConfig) config;
    }

    @Override
    protected String decryptPayload(Response response, String responsePayload) throws EncryptionException {
        return JweEncryption.decryptPayload(responsePayload, config);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy