1、安装hmac-auth插件
我这里使用的kong管理界面为konga,在插件中选择hmac-auth插件
接下来我们对hmac-auth插件进行配置
下一步就是如何请求使用hmac-auth插件的网关了,我这里语言使用的是java,加密算法使用的是hmac-sha256,不多说,直接上代码
package com.kong.demo.test;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DateFormat;
import