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

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

The 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.OpenId;

import java.util.Map;

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

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

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

    @Override
    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