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

com.dahuatech.icc.oauth.model.v202010.OauthPwdCheckRequest Maven / Gradle / Ivy

The newest version!
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;

/**
 * 密码验证,需鉴权
 *
 * @author 232676
 * @since 1.0.0 2020-10-24 20:59:11
 */
public class OauthPwdCheckRequest extends AbstractIccRequest {
  /** 用户名 */
  private String loginName;
  /** 登录密码,需RSA加密 */
  private String loginPass;
  /** 公钥 */
  private String public_key;

    public OauthPwdCheckRequest() {
    super(OauthConstant.url(OauthConstant.OAUTH_URL_PWD_CHECK_POST), Method.POST, Boolean.TRUE);
  }

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

  public String getLoginName() {
    return loginName;
  }

  public void setLoginName(String loginName) {
    this.loginName = loginName;
    putBodyParameter("loginName", loginName);
  }

  public String getLoginPass() {
    return loginPass;
  }

  public void setLoginPass(String loginPass) {
    this.loginPass = loginPass;
    putBodyParameter("loginPass", loginPass);
  }

  public String getPublic_key() {
    return public_key;
  }

  public void setPublic_key(String public_key) {
    this.public_key = public_key;
    putBodyParameter("public_key", public_key);
  }

    public void businessValid() {
        if(StringUtils.isEmpty(loginName)){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "loginName");
        }
        if(StringUtils.isEmpty(loginPass)){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "loginPass");
        }
        if(StringUtils.isEmpty(public_key)){
            throw new BusinessException(ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getCode(), ParamValidEnum.PARAM_NOT_EMPTY_ERROR.getErrMsg(), "public_key");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy