Java Code Examples for cn.jiguang.common.ServiceHelper#getBasicAuthorization()

The following examples show how to use cn.jiguang.common.ServiceHelper#getBasicAuthorization() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SMSClient.java    From jsms-api-java-client with MIT License 6 votes vote down vote up
public SMSClient(String masterSecret, String appkey, HttpProxy proxy, JSMSConfig conf) {
    ServiceHelper.checkBasic(appkey, masterSecret);

    _baseUrl = (String) conf.get(JSMSConfig.API_HOST_NAME);
    _smsCodePath = (String) conf.get(JSMSConfig.CODE_PATH);
    _validPath = (String) conf.get(JSMSConfig.VALID_PATH);
    _voiceCodePath = (String) conf.get(JSMSConfig.VOICE_CODE_PATH);
    _shortMsgPath = (String) conf.get(JSMSConfig.SHORT_MESSAGE_PATH);
    _tempMsgPath = (String) conf.get(JSMSConfig.TEMPlATE_MESSAGE_PATH);
    _signPath = (String) conf.get(JSMSConfig.SIGN_PATH);
    _signDefaultPath = (String) conf.get(JSMSConfig.SIGN_DEFAULT_PATH);
    _schedulePath = (String) conf.get(JSMSConfig.SCHEDULE_PATH);
    _accountPath = (String) conf.get(JSMSConfig.ACCOUNT_PATH);
    String authCode = ServiceHelper.getBasicAuthorization(appkey, masterSecret);
    _authCode = authCode;
    this._httpClient = new NativeHttpClient(authCode, proxy, conf.getClientConfig());
}
 
Example 2
Source File: HttpProxy.java    From jiguang-java-client-common with MIT License 4 votes vote down vote up
public String getProxyAuthorization() {
    return ServiceHelper.getBasicAuthorization(username, password);
}
 
Example 3
Source File: BaseClient.java    From jmessage-api-java-client with MIT License 3 votes vote down vote up
/**
 * Create a JMessage Base Client
 *
 * @param appKey The KEY of one application on JPush.
 * @param masterSecret API access secret of the appKey.
 * @param proxy The proxy, if there is no proxy, should be null.
 * @param config The client configuration. Can use JMessageConfig.getInstance() as default.
 */
public BaseClient(String appKey, String masterSecret, HttpProxy proxy, JMessageConfig config) {
    ServiceHelper.checkBasic(appKey, masterSecret);
    String authCode = ServiceHelper.getBasicAuthorization(appKey, masterSecret);
    this._baseUrl = (String) config.get(JMessageConfig.API_HOST_NAME);
    this._httpClient = new NativeHttpClient(authCode, proxy, config.getClientConfig());
}
 
Example 4
Source File: ResourceClient.java    From jmessage-api-java-client with MIT License 2 votes vote down vote up
/**
 * Create a JMessage Base Client
 *
 * @param appkey       The KEY of one application on JPush.
 * @param masterSecret API access secret of the appKey.
 * @param proxy        The proxy, if there is no proxy, should be null.
 * @param config       The client configuration. Can use JMessageConfig.getInstance() as default.
 */
public ResourceClient(String appkey, String masterSecret, HttpProxy proxy, JMessageConfig config) {
    super(appkey, masterSecret, proxy, config);
    this.resourcePath = (String) config.get(JMessageConfig.RESOURCE_PATH);
    this.authCode = ServiceHelper.getBasicAuthorization(appkey, masterSecret);
}