![JAR search and dependency download from the Maven repository](/logo.png)
com.dahuatech.icc.oauth.model.v202010.OauthClientAuthRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk-oauth Show documentation
Show all versions of java-sdk-oauth Show documentation
Dahua ICC Open API SDK for Java
package com.dahuatech.icc.oauth.model.v202010;
import com.dahuatech.hutool.http.Method;
import com.dahuatech.icc.common.ParamValidEnum;
import com.dahuatech.icc.exception.ClientException;
import com.dahuatech.icc.oauth.constant.OauthConstant;
import com.dahuatech.icc.oauth.exception.BusinessException;
import com.dahuatech.icc.oauth.http.AbstractIccRequest;
import com.dahuatech.icc.oauth.model.v202010.oSDK.OauthParamConstant;
import com.dahuatech.icc.util.StringUtils;
/**
* 客户端认证授权,方法GET和POST,数据使用form
*
* @author 232676
* @since 1.0.0 2020-10-24 20:59:11
*/
public class OauthClientAuthRequest extends AbstractIccRequest {
/** 授权类型,固定值:client_credentials */
private String grant_type;
/** 客户端client_id */
private String client_id;
/** 客户端client_secret */
private String client_secret;
public OauthClientAuthRequest() throws ClientException {
super(OauthConstant.url(OauthConstant.OAUTH_URL_CLIENT_AUTH), Method.POST, Boolean.FALSE);
}
@Override
public Class getResponseClass() {
return OauthClientAuthResponse.class;
}
public String getGrant_type() {
return grant_type;
}
public void setGrant_type(String grant_type) {
this.grant_type = grant_type;
form("grant_type", grant_type);
}
public String getClient_id() {
return client_id;
}
public void setClient_id(String client_id) {
this.client_id = client_id;
form("client_id", client_id);
}
public String getClient_secret() {
return client_secret;
}
public void setClient_secret(String client_secret) {
this.client_secret = client_secret;
form("client_secret", client_secret);
}
public void businessValid() {
if(StringUtils.isEmpty(grant_type)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "grant_type");
}
if(StringUtils.isEmpty(client_id)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "client_id");
}
if(StringUtils.isEmpty(client_secret)){
throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "client_secret");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy