Search in sources :

Example 1 with AuthenticationInterceptor

use of com.fastaccess.provider.rest.interceptors.AuthenticationInterceptor in project FastHub by k0shk0sh.

the class JsoupProvider method provideOkHttpClient.

private static OkHttpClient provideOkHttpClient() {
    if (okHttpClient == null) {
        OkHttpClient.Builder client = new OkHttpClient.Builder();
        if (BuildConfig.DEBUG) {
            client.addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY));
        }
        client.addInterceptor(new AuthenticationInterceptor(true));
        okHttpClient = client.build();
    }
    return okHttpClient;
}
Also used : OkHttpClient(okhttp3.OkHttpClient) AuthenticationInterceptor(com.fastaccess.provider.rest.interceptors.AuthenticationInterceptor) HttpLoggingInterceptor(okhttp3.logging.HttpLoggingInterceptor)

Example 2 with AuthenticationInterceptor

use of com.fastaccess.provider.rest.interceptors.AuthenticationInterceptor in project FastHub by k0shk0sh.

the class LoginProvider method provideOkHttpClient.

private static OkHttpClient provideOkHttpClient(@Nullable String authToken, @Nullable String otp) {
    OkHttpClient.Builder client = new OkHttpClient.Builder();
    if (BuildConfig.DEBUG) {
        client.addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY));
    }
    client.addInterceptor(new AuthenticationInterceptor(authToken, otp));
    return client.build();
}
Also used : OkHttpClient(okhttp3.OkHttpClient) AuthenticationInterceptor(com.fastaccess.provider.rest.interceptors.AuthenticationInterceptor) GsonBuilder(com.google.gson.GsonBuilder) HttpLoggingInterceptor(okhttp3.logging.HttpLoggingInterceptor)

Example 3 with AuthenticationInterceptor

use of com.fastaccess.provider.rest.interceptors.AuthenticationInterceptor in project FastHub by k0shk0sh.

the class RestProvider method provideOkHttpClient.

public static OkHttpClient provideOkHttpClient() {
    if (okHttpClient == null) {
        OkHttpClient.Builder client = new OkHttpClient.Builder();
        if (BuildConfig.DEBUG) {
            client.addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY));
        }
        client.addInterceptor(new AuthenticationInterceptor());
        client.addInterceptor(new PaginationInterceptor());
        client.addInterceptor(new ContentTypeInterceptor());
        okHttpClient = client.build();
    }
    return okHttpClient;
}
Also used : OkHttpClient(okhttp3.OkHttpClient) AuthenticationInterceptor(com.fastaccess.provider.rest.interceptors.AuthenticationInterceptor) GsonBuilder(com.google.gson.GsonBuilder) ContentTypeInterceptor(com.fastaccess.provider.rest.interceptors.ContentTypeInterceptor) HttpLoggingInterceptor(okhttp3.logging.HttpLoggingInterceptor) PaginationInterceptor(com.fastaccess.provider.rest.interceptors.PaginationInterceptor)

Aggregations

AuthenticationInterceptor (com.fastaccess.provider.rest.interceptors.AuthenticationInterceptor)3 OkHttpClient (okhttp3.OkHttpClient)3 HttpLoggingInterceptor (okhttp3.logging.HttpLoggingInterceptor)3 GsonBuilder (com.google.gson.GsonBuilder)2 ContentTypeInterceptor (com.fastaccess.provider.rest.interceptors.ContentTypeInterceptor)1 PaginationInterceptor (com.fastaccess.provider.rest.interceptors.PaginationInterceptor)1