All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.authlete.common.conf.AuthleteEnvConfiguration Maven / Gradle / Ivy

Go to download

Authlete Java library used commonly by service implementations and the Authlete server.

There is a newer version: 4.15
Show newest version
/*
 * Copyright (C) 2014-2022 Authlete, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.authlete.common.conf;


/**
 * Implementation of {@link AuthleteConfiguration} based on
 * environment variables.
 *
 * 

* This class refers to the following environment variables. *

* *
*
*
AUTHLETE_BASE_URL
*

The base URL.

* *
AUTHLETE_SERVICEOWNER_APIKEY
*

The API key of the service owner.

* *
AUTHLETE_SERVICEOWNER_APISECRET
*

The API secret of the service owner.

* *
AUTHLETE_SERVICE_APIKEY
*

The API key of the service.

* *
AUTHLETE_SERVICE_APISECRET
*

The API secret of the service.

*
*
*/ public class AuthleteEnvConfiguration implements AuthleteConfiguration { private static final String ENV_KEY_BASE_URL = "AUTHLETE_BASE_URL"; private static final String ENV_KEY_SERVICE_OWNER_API_KEY = "AUTHLETE_SERVICEOWNER_APIKEY"; private static final String ENV_KEY_SERVICE_OWNER_API_SECRET = "AUTHLETE_SERVICEOWNER_APISECRET"; private static final String ENV_KEY_SERVICE_API_KEY = "AUTHLETE_SERVICE_APIKEY"; private static final String ENV_KEY_SERVICE_API_SECRET = "AUTHLETE_SERVICE_APISECRET"; private static final String ENV_KEY_SERVICE_OWNER_ACCESS_TOKEN = "AUTHLETE_SERVICEOWNER_ACCESSTOKEN"; private static final String ENV_KEY_SERVICE_ACCESS_TOKEN = "AUTHLETE_SERVICE_ACCESSTOKEN"; private static final String ENV_KEY_DPOP_KEY = "AUTHLETE_DPOP_KEY"; private static final String ENV_KEY_CLIENT_CERTIFICATE = "AUTHLETE_CLIENT_CERTIFICATE"; private static final String ENV_KEY_API_VERSION = "AUTHLETE_API_VERSION"; @Override public String getApiVersion() { return get(ENV_KEY_API_VERSION); } @Override public String getBaseUrl() { return get(ENV_KEY_BASE_URL); } @Override public String getServiceOwnerApiKey() { return get(ENV_KEY_SERVICE_OWNER_API_KEY); } @Override public String getServiceOwnerApiSecret() { return get(ENV_KEY_SERVICE_OWNER_API_SECRET); } @Override public String getServiceOwnerAccessToken() { return get(ENV_KEY_SERVICE_OWNER_ACCESS_TOKEN); } @Override public String getServiceApiKey() { return get(ENV_KEY_SERVICE_API_KEY); } @Override public String getServiceApiSecret() { return get(ENV_KEY_SERVICE_API_SECRET); } @Override public String getServiceAccessToken() { return get(ENV_KEY_SERVICE_ACCESS_TOKEN); } @Override public String getDpopKey() { return get(ENV_KEY_DPOP_KEY); } @Override public String getClientCertificate() { return get(ENV_KEY_CLIENT_CERTIFICATE); } private String get(String key) { return System.getenv(key); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy