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

ru.dezhik.sms.sender.api.smsru.auth.DefaultAuthProvider Maven / Gradle / Ivy

There is a newer version: 0.1.3
Show newest version
package ru.dezhik.sms.sender.api.smsru.auth;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import ru.dezhik.sms.sender.SenderServiceConfiguration;

/**
 * @author ilya.dezhin
 */
public class DefaultAuthProvider implements AuthProvider {
    private final SenderServiceConfiguration config;

    public DefaultAuthProvider(SenderServiceConfiguration config) {
        this.config = config;
        if (config.getApiId() == null || config.getApiId().isEmpty()) {
            throw new IllegalStateException("ApiId in required for default authentication.");
        }
    }

    @Override
    public List provideAuthParams() {
        List params = new ArrayList();
        params.add(new BasicNameValuePair("api_id", config.getApiId()));
        return params;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy