Search in sources :

Example 1 with ApiKeyAuth

use of org.wso2.carbon.apimgt.rest.integration.tests.store.auth.ApiKeyAuth in project product-apim by wso2.

the class ApiClient method setApiKey.

/**
 * Helper method to configure the first api key found
 *
 * @param apiKey API key
 */
public void setApiKey(String apiKey) {
    for (RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
        if (apiAuthorization instanceof ApiKeyAuth) {
            ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization;
            keyAuth.setApiKey(apiKey);
            return;
        }
    }
    throw new RuntimeException("No API key authentication configured!");
}
Also used : RequestInterceptor(feign.RequestInterceptor) ApiKeyAuth(org.wso2.carbon.apimgt.rest.integration.tests.store.auth.ApiKeyAuth)

Aggregations

RequestInterceptor (feign.RequestInterceptor)1 ApiKeyAuth (org.wso2.carbon.apimgt.rest.integration.tests.store.auth.ApiKeyAuth)1