public static String encryptValueAsJwtDirectAes128Sha256(final Key key, final Serializable value) {
        return JsonWebTokenEncryptor.builder()
            .key(key)
            .algorithm(KeyManagementAlgorithmIdentifiers.DIRECT)
            .encryptionMethod(ContentEncryptionAlgorithmIdentifiers.AES_128_CBC_HMAC_SHA_256)
            .build()
            .encrypt(value);
    }
Encrypt value as jwt with direct algorithm and encryption content alg aes-128-sha-256.

@param key   the key
@param value the value
@return the string
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java