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

com.hn.im.easemob.comm.body.AuthTokenBody Maven / Gradle / Ivy

There is a newer version: 1.0.18
Show newest version
package com.hn.im.easemob.comm.body;

import cn.hutool.core.util.StrUtil;
import com.fasterxml.jackson.databind.node.ContainerNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.hn.im.easemob.comm.wrapper.BodyWrapper;

public class AuthTokenBody implements BodyWrapper {
	
	private String grantType = "client_credentials";
	
	private String clientId;
	
	private String clientSecret;

	public AuthTokenBody(String clientId, String clientSecret) {
		super();
		this.clientId = clientId;
		this.clientSecret = clientSecret;
	}

	public String getGrantType() {
		return grantType;
	}

	public void setGrantType(String grantType) {
		this.grantType = grantType;
	}

	public String getClientId() {
		return clientId;
	}

	public void setClientId(String clientId) {
		this.clientId = clientId;
	}

	public String getClientSecret() {
		return clientSecret;
	}

	public void setClientSecret(String clientSecret) {
		this.clientSecret = clientSecret;
	}

	public ContainerNode getBody() {
		return JsonNodeFactory.instance.objectNode().put("grant_type", grantType).put("client_id", clientId).put("client_secret", clientSecret);
	}

	public Boolean validate() {
		return StrUtil.isNotBlank(clientId) && StrUtil.isNotBlank(clientSecret);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy