public class SignitClient extends Object
2018-12-8 将此Client扩展为易企签所有开放平台应用公共使用的Client 2019-07-31 将成员变量全部ThreadLocal化,支持单例使用SignitClient对象,保证线程安全
| 构造器和说明 |
|---|
SignitClient(Authentication auth)
默认为:快捷签署客户端.
|
SignitClient(Authentication auth,
String envUrl)
已过时。
|
SignitClient(String appId,
String secretKey,
String appUrl)
应用客户端.
|
| 限定符和类型 | 方法和说明 |
|---|---|
<T extends AbstractSignitResponse> |
execute(AbstractSignitRequest<T> request) |
OauthData |
getOauthData(String apiKey,
String secretKey,
TokenType grantType,
boolean autoSetRequestToken) |
WebhookData |
parseWebhookData(String webhook)
快捷签署webhook响应数据解析.
|
static WebhookResponse |
parseWebhookResponse(String webhook)
解析webhook响应数据.
|
SignatureResponse |
sendSignatureRequest(SignatureRequest request)
发送快捷签署请求.
|
SignitClient |
setEnvironmentUrl(String url)
已过时。
|
SignitClient |
setOauthUrl(String url)
设置授权请求路径.
|
SignitClient |
setSignUrl(String url)
已过时。
|
static boolean |
verify(String appId,
String appSecretKey,
byte[] body,
javax.servlet.http.HttpServletRequest request)
客户端验证服务器的webhook响应数据
|
static boolean |
verify(String signitSignature,
String appId,
HmacSignatureBuilder builder)
客户端验证服务器的webhook响应数据.
|
public SignitClient(Authentication auth)
auth - 授权信息@Deprecated public SignitClient(Authentication auth, String envUrl)
auth - 授权信息envUrl - 应用环境@Deprecated public SignitClient setEnvironmentUrl(String url)
url - 应用环境public SignitClient setOauthUrl(String url)
url - 授权请求路径@Deprecated public SignitClient setSignUrl(String url)
url - 快捷签署请求路径public SignatureResponse sendSignatureRequest(SignatureRequest request) throws SignitException, IOException
request - 快捷签署请求SignitException - 易企签自定义异常IOException - 数据流异常public OauthData getOauthData(String apiKey, String secretKey, TokenType grantType, boolean autoSetRequestToken) throws SignitException
SignitExceptionpublic WebhookData parseWebhookData(String webhook)
webhook - webhook Json格式数据字符串public static WebhookResponse parseWebhookResponse(String webhook)
webhook - webhook Json格式字符串public <T extends AbstractSignitResponse> T execute(AbstractSignitRequest<T> request) throws SignitException
SignitExceptionpublic static boolean verify(String signitSignature, String appId, HmacSignatureBuilder builder)
signitSignature - webhook响应header中x-signit-signature数据。服务器构建的hmac,用于客户端验证服务器appId - APP IDbuilder - hmac签名建造器public static boolean verify(String appId, String appSecretKey, byte[] body, javax.servlet.http.HttpServletRequest request) throws IOException
appId - APP IDappSecretKey - APP Secretbody - webhook响应具体数据。考虑到request中只能获取到body一次,故而需要在方法外获取并传递给此方法request - 服务端向客户端发起的请求IOException - 数据流异常Copyright © 2019. All rights reserved.