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

eleme.openapi.sdk.oauth.request.ServerTokenRequest Maven / Gradle / Ivy

There is a newer version: 1.30.71
Show newest version
package eleme.openapi.sdk.oauth.request;

import eleme.openapi.sdk.config.Config;
import eleme.openapi.sdk.config.Constants;
import eleme.openapi.sdk.oauth.BaseOAuthRequest;
import eleme.openapi.sdk.oauth.response.Token;

import java.util.Map;

public class ServerTokenRequest extends BaseOAuthRequest {
    private Config context;
    public ServerTokenRequest(Config context) {
        this.context = context;
    }
    private String code;
    private String redirectUri;

    public Class getResponseClass() {
        return Token.class;
    }

    public Map getHeaderMap()  {
        setAuthorization(context.getApp_key(), context.getApp_secret(), Constants.TOKEN_SIGN);
        return super.headerMap;
    }

    public Map getBodyMap()  {
        putBodyParam("grant_type", "authorization_code");
        putBodyParam("code", this.code);
        putBodyParam("redirect_uri", this.redirectUri);
        putBodyParam("client_id", context.getApp_key());
        return super.bodyMap;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public void setRedirectUri(String redirectUri) {
        this.redirectUri = redirectUri;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy