Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add temporary API Key authenticator impl #3603

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion adapter/config/default_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ var defaultConfig = &Config{
DropConsoleTestHeaders: true,
},
APIKeyConfig: apiKeyConfig{
OAuthAgentURL: "https://localhost:9443",
InternalAPIKeyHeader: "Choreo-API-Key",
OAuthAgentURL: "https://localhost:9443",
},
PATConfig: patConfig{
TokenExpiryTimeSkew: 1,
Expand Down
3 changes: 2 additions & 1 deletion adapter/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ type authHeader struct {
}

type apiKeyConfig struct {
OAuthAgentURL string `toml:"oauthAgentURL"`
InternalAPIKeyHeader string `toml:"internalAPIKeyHeader"`
OAuthAgentURL string `toml:"oauthAgentURL"`
}

type patConfig struct {
Expand Down
3 changes: 2 additions & 1 deletion adapter/internal/discovery/xds/marshaller.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ func MarshalConfig(config *config.Config) *enforcer.Config {
DropConsoleTestHeaders: config.Enforcer.Security.AuthHeader.DropConsoleTestHeaders,
},
ApiKeyConfig: &enforcer.APIKeyConfig{
OauthAgentURL: config.Enforcer.Security.APIKeyConfig.OAuthAgentURL,
InternalAPIKeyHeader: config.Enforcer.Security.APIKeyConfig.InternalAPIKeyHeader,
OauthAgentURL: config.Enforcer.Security.APIKeyConfig.OAuthAgentURL,
},
PatConfig: &enforcer.PATConfig{
TokenExpiryTimeSkew: config.Enforcer.Security.PATConfig.TokenExpiryTimeSkew,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ option java_multiple_files = true;

message APIKeyConfig {
string oauthAgentURL = 1;
string internalAPIKeyHeader = 2;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ private void populateAuthHeaderConfigurations(AuthHeader authHeader) {

private void populateAPIKeyConfigs(APIKeyConfig apiKeyConfig) {
APIKeyDTO apiKeyDTO = new APIKeyDTO();
apiKeyDTO.setApiKeyInternalHeader(apiKeyConfig.getInternalAPIKeyHeader());
apiKeyDTO.setOauthAgentURL(apiKeyConfig.getOauthAgentURL());
config.setApiKeyConfig(apiKeyDTO);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,17 @@
*/
public class APIKeyDTO {

private String apiKeyInternalHeader;
private String oauthAgentURL;

public String getApiKeyInternalHeader() {
return apiKeyInternalHeader;
}

public void setApiKeyInternalHeader(String apiKeyInternalHeader) {
this.apiKeyInternalHeader = apiKeyInternalHeader;
}

public String getOauthAgentURL() {
return oauthAgentURL;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class APIConstants {
public static final String API_SECURITY_MUTUAL_SSL = "mutualssl";
public static final String API_SECURITY_BASIC_AUTH = "basic_auth";
public static final String SWAGGER_API_KEY_AUTH_TYPE_NAME = "apiKey";
public static final String API_SECURITY_CHOREO_API_KEY = "api_key";
public static final String SWAGGER_API_KEY_IN_HEADER = "header";
public static final String SWAGGER_API_KEY_IN_QUERY = "query";
public static final String API_SECURITY_MUTUAL_SSL_MANDATORY = "mutualssl_mandatory";
Expand Down
Loading
Loading