Search in sources :

Example 1 with ApiKeyAuth

use of io.swagger.client.auth.ApiKeyAuth in project android-client by GenesisVision.

the class GsonCustomConverterFactory method setApiKey.

/**
 * Helper method to configure the first api key found
 * @param apiKey API key
 * @return ApiClient
 */
public ApiClient setApiKey(String apiKey) {
    for (Interceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof ApiKeyAuth) {
            ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization;
            keyAuth.setApiKey(apiKey);
            return this;
        }
    }
    return this;
}
Also used : ApiKeyAuth(io.swagger.client.auth.ApiKeyAuth) Interceptor(okhttp3.Interceptor)

Example 2 with ApiKeyAuth

use of io.swagger.client.auth.ApiKeyAuth in project ef-app_android by eurofurence.

the class ApiInvoker method initializeInstance.

public static void initializeInstance(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) {
    INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout);
    setUserAgent("Swagger-Codegen/1.0.0/android");
    // Setup authentications (key: authentication name, value: authentication).
    INSTANCE.authentications = new HashMap<String, Authentication>();
    INSTANCE.authentications.put("Bearer", new ApiKeyAuth("header", "Authorization"));
    // Prevent the authentications from being modified.
    INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
}
Also used : Authentication(io.swagger.client.auth.Authentication) ApiKeyAuth(io.swagger.client.auth.ApiKeyAuth)

Aggregations

ApiKeyAuth (io.swagger.client.auth.ApiKeyAuth)2 Authentication (io.swagger.client.auth.Authentication)1 Interceptor (okhttp3.Interceptor)1