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

com.aiwiown.face.request.AppBizTokenRequest Maven / Gradle / Ivy

There is a newer version: 3.0.9
Show newest version
package com.aiwiown.face.request;

import com.aiwiown.face.ApiMethod;
import com.aiwiown.face.ApiObject;
import com.aiwiown.face.ApiRequest;
import com.aiwiown.face.internal.safe.HmacSha1Sign;
import com.aiwiown.face.internal.util.RequestParamUtils;
import com.aiwiown.face.response.AppBizTokenResponse;

import java.util.Map;

/**
 * 此接口用于配置人脸比对参数,支持KYC验证和人脸比对。客户通过服务器将本次活体相关的配置传到FaceID服务器,
 *  在验证无误后,返回本次业务的biz_token,用FaceID MegLiveStill SDK的初始化。
 *  https://faceid.com/pages/documents/37661898
 * @ClassName : AppBizTokenRequest
 * @Description :
 * @Author : dbin0123
 * @Date: 2020-03-15 18:09
 */
public class AppBizTokenRequest implements ApiRequest {

    private String apiVersion = "v3";
    private static String apiUrl = "/sdk/get_biz_token";

    private static final String SIGN_TYPE = "hmac_sha1";
    private static final long EXPIRED = 60L;
    private String bizContent;
    private ApiObject bizModel = null;

    @Override
    public ApiMethod getApiMethod() {
        return ApiMethod.POST;
    }

    @Override
    public String getApiUrl() {
        return "/" + this.apiVersion + apiUrl;
    }

    @Override
    public Map getTextParams() throws IllegalAccessException {
        return RequestParamUtils.getTextParams(this.bizModel);
    }

    @Override
    public Map getByteArrayParams() throws IllegalAccessException {
        return RequestParamUtils.getByteArrayParams(this.bizModel);
    }

    @Override
    public Class getResponseClass() {
        return AppBizTokenResponse.class;
    }

    @Override
    public String getApiVersion() {
        return this.apiVersion;
    }

    @Override
    public String getBizContent() {
        return this.bizContent;
    }

    public void setBizModel(ApiObject bizModel) {
        this.bizModel = bizModel;
    }

    @Override
    public String signVersion() {
        return SIGN_TYPE;
    }

    @Override
    public String getSignInfo(String apiKey, String secretKey) throws Exception {
        return HmacSha1Sign.genSign(apiKey, secretKey, EXPIRED);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy