Search in sources :

Example 1 with Authentication

use of io.swagger.client.auth.Authentication 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)

Example 2 with Authentication

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

the class ApiInvoker method updateParamsForAuth.

/**
 * Update query and header parameters based on authentication settings.
 *
 * @param authNames The authentications to apply
 */
private void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams) {
    for (String authName : authNames) {
        Authentication auth = authentications.get(authName);
        if (auth == null)
            throw new RuntimeException("Authentication undefined: " + authName);
        auth.applyToParams(queryParams, headerParams);
    }
}
Also used : Authentication(io.swagger.client.auth.Authentication)

Example 3 with Authentication

use of io.swagger.client.auth.Authentication in project ImmunogeneticDataTools by nmdp-bioinformatics.

the class ApiClient method updateParamsForAuth.

/**
 * Update query and header parameters based on authentication settings.
 *
 * @param authNames The authentications to apply
 * @param queryParams  List of query parameters
 * @param headerParams  Map of header parameters
 */
public void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams) {
    for (String authName : authNames) {
        Authentication auth = authentications.get(authName);
        if (auth == null)
            throw new RuntimeException("Authentication undefined: " + authName);
        auth.applyToParams(queryParams, headerParams);
    }
}
Also used : Authentication(io.swagger.client.auth.Authentication)

Aggregations

Authentication (io.swagger.client.auth.Authentication)3 ApiKeyAuth (io.swagger.client.auth.ApiKeyAuth)1