Search in sources :

Example 1 with ApiKeyAuth

use of com.baeldung.petstore.client.invoker.auth.ApiKeyAuth in project tutorials by eugenp.

the class ApiClient method init.

protected void init() {
    // Use RFC3339 format for date and datetime.
    // See http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14
    this.dateFormat = new RFC3339DateFormat();
    // Use UTC as the default time zone.
    this.dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
    // Set default User-Agent.
    setUserAgent("Java-SDK");
    // Setup authentications (key: authentication name, value: authentication).
    authentications = new HashMap<String, Authentication>();
    authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
    authentications.put("petstore_auth", new OAuth());
    // Prevent the authentications from being modified.
    authentications = Collections.unmodifiableMap(authentications);
}
Also used : Authentication(com.baeldung.petstore.client.invoker.auth.Authentication) ApiKeyAuth(com.baeldung.petstore.client.invoker.auth.ApiKeyAuth) OAuth(com.baeldung.petstore.client.invoker.auth.OAuth)

Aggregations

ApiKeyAuth (com.baeldung.petstore.client.invoker.auth.ApiKeyAuth)1 Authentication (com.baeldung.petstore.client.invoker.auth.Authentication)1 OAuth (com.baeldung.petstore.client.invoker.auth.OAuth)1