mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-25 08:50:18 +00:00
[Backend][Improvement] Using Generated Configurations files (#6130)
* [Backend][Improvement] Using Generated Configurations files * [Backend][Improvement] Test failure * [Backend][Improvement] Update Descriptions * [Backend][Improvement] Config Resource Test Failure Fix
This commit is contained in:
parent
5af56a88a9
commit
2271148eb3
@ -36,82 +36,98 @@ import org.openmetadata.catalog.slack.SlackPublisherConfiguration;
|
||||
import org.openmetadata.catalog.slackChat.SlackChatConfiguration;
|
||||
|
||||
public class CatalogApplicationConfig extends Configuration {
|
||||
@JsonProperty("database")
|
||||
private static final String DATABASE_CONFIG = "database";
|
||||
private static final String SWAGGER_CONFIG = "swagger";
|
||||
private static final String AUTHORIZER_CONFIG = "authorizerConfiguration";
|
||||
private static final String AUTHENTICATION_CONFIG = "authenticationConfiguration";
|
||||
private static final String JWT_CONFIG = "jwtTokenConfiguration";
|
||||
private static final String ELASTIC_CONFIG = "elasticsearch";
|
||||
private static final String EVENTHANDLER_CONFIG = "eventHandlerConfiguration";
|
||||
private static final String AIRFLOW_CONFIG = "airflowConfiguration";
|
||||
private static final String SLACK_CONFIG = "slackEventPublishers";
|
||||
private static final String FERNET_CONFIG = "fernetConfiguration";
|
||||
private static final String HEALTH_CONFIG = "health";
|
||||
private static final String MIGRATION_CONFIG = "migrationConfiguration";
|
||||
private static final String SANDBOXMODE_CONFIG = "sandboxModeEnabled";
|
||||
private static final String SLACK_CHAT_CONFIG = "slackChat";
|
||||
private static final String SECRET_MANAGER_CONFIG = "secretsManagerConfiguration";
|
||||
|
||||
@JsonProperty(DATABASE_CONFIG)
|
||||
@NotNull
|
||||
@Valid
|
||||
@Getter
|
||||
@Setter
|
||||
private DataSourceFactory dataSourceFactory;
|
||||
|
||||
@JsonProperty("swagger")
|
||||
@JsonProperty(SWAGGER_CONFIG)
|
||||
@Getter
|
||||
@Setter
|
||||
private SwaggerBundleConfiguration swaggerBundleConfig;
|
||||
|
||||
@JsonProperty("authorizerConfiguration")
|
||||
@JsonProperty(AUTHORIZER_CONFIG)
|
||||
@Getter
|
||||
@Setter
|
||||
private AuthorizerConfiguration authorizerConfiguration;
|
||||
|
||||
@JsonProperty("authenticationConfiguration")
|
||||
@JsonProperty(AUTHENTICATION_CONFIG)
|
||||
@Getter
|
||||
@Setter
|
||||
private AuthenticationConfiguration authenticationConfiguration;
|
||||
|
||||
@JsonProperty("jwtTokenConfiguration")
|
||||
@JsonProperty(JWT_CONFIG)
|
||||
@Getter
|
||||
@Setter
|
||||
private JWTTokenConfiguration jwtTokenConfiguration;
|
||||
|
||||
@JsonProperty("elasticsearch")
|
||||
@JsonProperty(ELASTIC_CONFIG)
|
||||
@Getter
|
||||
@Setter
|
||||
private ElasticSearchConfiguration elasticSearchConfiguration;
|
||||
|
||||
@JsonProperty("eventHandlerConfiguration")
|
||||
@JsonProperty(EVENTHANDLER_CONFIG)
|
||||
@Getter
|
||||
@Setter
|
||||
private EventHandlerConfiguration eventHandlerConfiguration;
|
||||
|
||||
@JsonProperty("airflowConfiguration")
|
||||
@JsonProperty(AIRFLOW_CONFIG)
|
||||
@Getter
|
||||
@Setter
|
||||
private AirflowConfiguration airflowConfiguration;
|
||||
|
||||
@JsonProperty("slackEventPublishers")
|
||||
@JsonProperty(SLACK_CONFIG)
|
||||
@Getter
|
||||
@Setter
|
||||
private List<SlackPublisherConfiguration> slackEventPublishers;
|
||||
|
||||
@JsonProperty("migrationConfiguration")
|
||||
@JsonProperty(MIGRATION_CONFIG)
|
||||
@NotNull
|
||||
@Getter
|
||||
@Setter
|
||||
private MigrationConfiguration migrationConfiguration;
|
||||
|
||||
@JsonProperty("fernetConfiguration")
|
||||
@JsonProperty(FERNET_CONFIG)
|
||||
@Getter
|
||||
@Setter
|
||||
private FernetConfiguration fernetConfiguration;
|
||||
|
||||
@JsonProperty("health")
|
||||
@JsonProperty(HEALTH_CONFIG)
|
||||
@NotNull
|
||||
@Valid
|
||||
@Getter
|
||||
@Setter
|
||||
private HealthConfiguration healthConfiguration = new HealthConfiguration();
|
||||
|
||||
@JsonProperty("sandboxModeEnabled")
|
||||
@JsonProperty(SANDBOXMODE_CONFIG)
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean sandboxModeEnabled;
|
||||
|
||||
@JsonProperty("slackChat")
|
||||
@JsonProperty(SLACK_CHAT_CONFIG)
|
||||
@Getter
|
||||
@Setter
|
||||
private SlackChatConfiguration slackChatConfiguration = new SlackChatConfiguration();
|
||||
|
||||
@JsonProperty("secretsManagerConfiguration")
|
||||
@JsonProperty(SECRET_MANAGER_CONFIG)
|
||||
@Getter
|
||||
@Setter
|
||||
private SecretsManagerConfiguration secretsManagerConfiguration;
|
||||
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2021 Collate
|
||||
* 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 org.openmetadata.catalog.airflow;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class AirflowConfiguration {
|
||||
|
||||
@NotEmpty @Getter @Setter private String apiEndpoint;
|
||||
|
||||
@NotEmpty @Getter @Setter private String username;
|
||||
|
||||
@NotEmpty @Getter @Setter private String password;
|
||||
|
||||
@Getter @Setter private Integer timeout = 30;
|
||||
|
||||
@NotEmpty @Getter @Setter private String metadataApiEndpoint;
|
||||
|
||||
@NotEmpty @Getter @Setter private String authProvider;
|
||||
|
||||
@Getter @Setter private AuthConfiguration authConfig;
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2021 Collate
|
||||
* 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 org.openmetadata.catalog.airflow;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.openmetadata.catalog.security.client.Auth0SSOClientConfig;
|
||||
import org.openmetadata.catalog.security.client.AzureSSOClientConfig;
|
||||
import org.openmetadata.catalog.security.client.CustomOIDCSSOClientConfig;
|
||||
import org.openmetadata.catalog.security.client.GoogleSSOClientConfig;
|
||||
import org.openmetadata.catalog.security.client.OktaSSOClientConfig;
|
||||
import org.openmetadata.catalog.security.client.OpenMetadataJWTClientConfig;
|
||||
|
||||
public class AuthConfiguration {
|
||||
|
||||
@Getter @Setter private GoogleSSOClientConfig google;
|
||||
|
||||
@Getter @Setter private OktaSSOClientConfig okta;
|
||||
|
||||
@Getter @Setter private Auth0SSOClientConfig auth0;
|
||||
|
||||
@Getter @Setter private AzureSSOClientConfig azure;
|
||||
|
||||
@Getter @Setter private CustomOIDCSSOClientConfig customOidc;
|
||||
|
||||
@Getter @Setter private OpenMetadataJWTClientConfig openmetadata;
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright 2021 Collate
|
||||
* 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 org.openmetadata.catalog.elasticsearch;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class ElasticSearchConfiguration {
|
||||
@NotEmpty @Getter @Setter private String host;
|
||||
@NotEmpty @Getter @Setter private Integer port;
|
||||
@Getter @Setter private String username;
|
||||
@Getter @Setter private String password;
|
||||
@Getter @Setter private String scheme;
|
||||
@Getter @Setter private String truststorePath;
|
||||
@Getter @Setter private String truststorePassword;
|
||||
@Getter @Setter private Integer connectionTimeoutSecs = 5;
|
||||
@Getter @Setter private Integer socketTimeoutSecs = 60;
|
||||
@Getter @Setter private Integer batchSize = 10;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ElasticSearchConfiguration{"
|
||||
+ "host='"
|
||||
+ host
|
||||
+ '\''
|
||||
+ ", port="
|
||||
+ port
|
||||
+ ", username='"
|
||||
+ username
|
||||
+ '\''
|
||||
+ '}';
|
||||
}
|
||||
}
|
@ -13,10 +13,7 @@
|
||||
|
||||
package org.openmetadata.catalog.events;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import javax.ws.rs.container.ContainerRequestContext;
|
||||
import javax.ws.rs.container.ContainerResponseContext;
|
||||
@ -43,7 +40,8 @@ public class EventFilter implements ContainerResponseFilter {
|
||||
|
||||
private void registerEventHandlers(CatalogApplicationConfig config, Jdbi jdbi) {
|
||||
try {
|
||||
Set<String> eventHandlerClassNames = config.getEventHandlerConfiguration().getEventHandlerClassNames();
|
||||
Set<String> eventHandlerClassNames =
|
||||
new HashSet<>(config.getEventHandlerConfiguration().getEventHandlerClassNames());
|
||||
for (String eventHandlerClassName : eventHandlerClassNames) {
|
||||
EventHandler eventHandler =
|
||||
((Class<EventHandler>) Class.forName(eventHandlerClassName)).getConstructor().newInstance();
|
||||
|
@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright 2021 Collate
|
||||
* 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 org.openmetadata.catalog.events;
|
||||
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class EventHandlerConfiguration {
|
||||
@Getter @Setter private Set<String> eventHandlerClassNames;
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2021 Collate
|
||||
* 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 org.openmetadata.catalog.fernet;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class FernetConfiguration {
|
||||
@NotEmpty private String fernetKey;
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright 2021 Collate
|
||||
* 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 org.openmetadata.catalog.security;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class AuthenticationConfiguration {
|
||||
@Getter @Setter private String provider;
|
||||
@Getter @Setter private String providerName;
|
||||
|
||||
/** @deprecated Use publicKeyUrls */
|
||||
@Deprecated(since = "0.9.1", forRemoval = true)
|
||||
@Getter
|
||||
@Setter
|
||||
private String publicKey;
|
||||
|
||||
@Getter @Setter private List<String> publicKeyUrls;
|
||||
@Getter @Setter private String authority;
|
||||
@Getter @Setter private String clientId;
|
||||
@Getter @Setter private String callbackUrl;
|
||||
@Getter @Setter private List<String> jwtPrincipalClaims;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AuthenticationConfiguration{"
|
||||
+ "provider='"
|
||||
+ provider
|
||||
+ '\''
|
||||
+ ", publicKeyUrls="
|
||||
+ publicKeyUrls
|
||||
+ ", authority='"
|
||||
+ authority
|
||||
+ '\''
|
||||
+ ", clientId='"
|
||||
+ clientId
|
||||
+ '\''
|
||||
+ ", callbackUrl='"
|
||||
+ callbackUrl
|
||||
+ '\''
|
||||
+ ", jwtPrincipalClaims="
|
||||
+ jwtPrincipalClaims
|
||||
+ '}';
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright 2021 Collate
|
||||
* 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 org.openmetadata.catalog.security;
|
||||
|
||||
import java.util.Set;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class AuthorizerConfiguration {
|
||||
@NotEmpty @Getter @Setter private String className;
|
||||
@NotEmpty @Getter @Setter private String containerRequestFilter;
|
||||
@NotEmpty @Getter @Setter private Set<String> adminPrincipals;
|
||||
@NotEmpty @Getter @Setter private Set<String> botPrincipals;
|
||||
@NotEmpty @Getter @Setter private String principalDomain;
|
||||
@NotEmpty @Getter @Setter private Boolean enforcePrincipalDomain;
|
||||
@NotEmpty @Getter @Setter private Boolean enableSecureSocketConnection;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AuthorizerConfiguration{"
|
||||
+ "className='"
|
||||
+ className
|
||||
+ '\''
|
||||
+ ", containerRequestFilter='"
|
||||
+ containerRequestFilter
|
||||
+ '\''
|
||||
+ '}';
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package org.openmetadata.catalog.security.jwt;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class JWTTokenConfiguration {
|
||||
@Getter @Setter private String RSAPublicKeyFilePath;
|
||||
@Getter @Setter private String RSAPrivateKeyFilePath;
|
||||
@Getter @Setter private String JWTIssuer;
|
||||
@Getter @Setter private String keyId;
|
||||
}
|
@ -48,19 +48,19 @@ public class JWTTokenGenerator {
|
||||
|
||||
public void init(JWTTokenConfiguration jwtTokenConfiguration) {
|
||||
try {
|
||||
if (jwtTokenConfiguration.getRSAPrivateKeyFilePath() != null
|
||||
&& !jwtTokenConfiguration.getRSAPrivateKeyFilePath().isEmpty()
|
||||
&& jwtTokenConfiguration.getRSAPublicKeyFilePath() != null
|
||||
&& !jwtTokenConfiguration.getRSAPublicKeyFilePath().isEmpty()) {
|
||||
byte[] privateKeyBytes = Files.readAllBytes(Paths.get(jwtTokenConfiguration.getRSAPrivateKeyFilePath()));
|
||||
if (jwtTokenConfiguration.getRsaprivateKeyFilePath() != null
|
||||
&& !jwtTokenConfiguration.getRsaprivateKeyFilePath().isEmpty()
|
||||
&& jwtTokenConfiguration.getRsapublicKeyFilePath() != null
|
||||
&& !jwtTokenConfiguration.getRsapublicKeyFilePath().isEmpty()) {
|
||||
byte[] privateKeyBytes = Files.readAllBytes(Paths.get(jwtTokenConfiguration.getRsaprivateKeyFilePath()));
|
||||
PKCS8EncodedKeySpec privateSpec = new PKCS8EncodedKeySpec(privateKeyBytes);
|
||||
KeyFactory privateKF = KeyFactory.getInstance("RSA");
|
||||
privateKey = (RSAPrivateKey) privateKF.generatePrivate(privateSpec);
|
||||
byte[] publicKeyBytes = Files.readAllBytes(Paths.get(jwtTokenConfiguration.getRSAPublicKeyFilePath()));
|
||||
byte[] publicKeyBytes = Files.readAllBytes(Paths.get(jwtTokenConfiguration.getRsapublicKeyFilePath()));
|
||||
X509EncodedKeySpec spec = new X509EncodedKeySpec(publicKeyBytes);
|
||||
KeyFactory kf = KeyFactory.getInstance("RSA");
|
||||
publicKey = (RSAPublicKey) kf.generatePublic(spec);
|
||||
issuer = jwtTokenConfiguration.getJWTIssuer();
|
||||
issuer = jwtTokenConfiguration.getJwtissuer();
|
||||
kid = jwtTokenConfiguration.getKeyId();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
@ -1,15 +0,0 @@
|
||||
package org.openmetadata.catalog.slack;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.openmetadata.catalog.type.EventFilter;
|
||||
|
||||
public class SlackPublisherConfiguration {
|
||||
@NotEmpty @Getter @Setter private String webhookUrl;
|
||||
@NotEmpty @Getter @Setter private String name;
|
||||
@NotEmpty @Getter @Setter private String openMetadataUrl;
|
||||
@Getter @Setter List<EventFilter> filters;
|
||||
@Getter @Setter private int batchSize = 10;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package org.openmetadata.catalog.slackChat;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SlackChatConfiguration {
|
||||
private String apiToken;
|
||||
private String botName;
|
||||
private List<String> channels;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
{
|
||||
"$id": "https://open-metadata.org/schema/entity/configuration/airflowConfiguration.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "AirflowConfiguration",
|
||||
"description": "This schema defines the AirFlow Configuration",
|
||||
"type": "object",
|
||||
"javaType": "org.openmetadata.catalog.airflow.AirflowConfiguration",
|
||||
"properties": {
|
||||
"apiEndpoint": {
|
||||
"description": "API host endpoint for Airflow",
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"description": "Username for Login",
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"description": "Password for Login",
|
||||
"type": "string"
|
||||
},
|
||||
"metadataApiEndpoint": {
|
||||
"description": "Metadata api endpoint",
|
||||
"type": "string"
|
||||
},
|
||||
"authProvider": {
|
||||
"description": "Auth Provider like no-auth, azure , google, okta, auth0, customOidc, openmetadata",
|
||||
"type": "string"
|
||||
},
|
||||
"timeout": {
|
||||
"description": "Timeout",
|
||||
"type": "integer",
|
||||
"default": 10
|
||||
},
|
||||
"authConfig": {
|
||||
"description": "Auth Provider Configuration ",
|
||||
"$ref": "authConfig.json"
|
||||
}
|
||||
},
|
||||
"required": ["apiEndpoint", "username", "password", "metadataApiEndpoint", "authProvider", "authConfig"],
|
||||
"additionalProperties": false
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
{
|
||||
"$id": "https://open-metadata.org/schema/entity/configuration/authConfig.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "AuthConfiguration",
|
||||
"description": "This schema defines the Auth Config.",
|
||||
"type": "object",
|
||||
"javaType": "org.openmetadata.catalog.airflow.AuthConfiguration",
|
||||
"properties": {
|
||||
"google": {
|
||||
"description": "Google SSO Configuration",
|
||||
"$ref": "../security/client/googleSSOClientConfig.json"
|
||||
},
|
||||
"okta": {
|
||||
"description": "Okta SSO Configuration",
|
||||
"$ref": "../security/client/oktaSSOClientConfig.json"
|
||||
},
|
||||
"auth0": {
|
||||
"description": "Auth0 SSO Configuration",
|
||||
"$ref": "../security/client/auth0SSOClientConfig.json"
|
||||
},
|
||||
"azure": {
|
||||
"description": "Azure SSO Configuration",
|
||||
"$ref": "../security/client/azureSSOClientConfig.json"
|
||||
},
|
||||
"customOidc": {
|
||||
"description": "Custom OIDC SSO Configuration",
|
||||
"$ref": "../security/client/customOidcSSOClientConfig.json"
|
||||
},
|
||||
"openmetadata": {
|
||||
"description": "OpenMetadata SSO Configuration",
|
||||
"$ref": "../security/client/openMetadataJWTClientConfig.json"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
{
|
||||
"$id": "https://open-metadata.org/schema/entity/configuration/authenticationConfiguration.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "AuthenticationConfiguration",
|
||||
"description": "This schema defines the Authentication Configuration.",
|
||||
"type": "object",
|
||||
"javaType": "org.openmetadata.catalog.security.AuthenticationConfiguration",
|
||||
"properties": {
|
||||
"provider": {
|
||||
"description": "SSO provider , no-auth, okta, google , azure etc.",
|
||||
"type": "string"
|
||||
},
|
||||
"providerName": {
|
||||
"description": "Custom OIDC Authentication Provider Name",
|
||||
"type": "string"
|
||||
},
|
||||
"publicKeyUrls": {
|
||||
"description": "List of Public Key URLs",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"authority": {
|
||||
"description": "Authentication Authority",
|
||||
"type": "string"
|
||||
},
|
||||
"clientId": {
|
||||
"description": "Client ID",
|
||||
"type": "string"
|
||||
},
|
||||
"callbackUrl": {
|
||||
"description": "Callback URL",
|
||||
"type": "string"
|
||||
},
|
||||
"jwtPrincipalClaims": {
|
||||
"description": "Jwt Principal Claim",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["provider", "providerName", "publicKeyUrls", "authority", "callbackUrl", "clientId", "jwtPrincipalClaims"],
|
||||
"additionalProperties": false
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
{
|
||||
"$id": "https://open-metadata.org/schema/entity/configuration/authorizerConfiguration.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "AuthorizerConfiguration",
|
||||
"description": "This schema defines the Authorization Configuration.",
|
||||
"type": "object",
|
||||
"javaType": "org.openmetadata.catalog.security.AuthorizerConfiguration",
|
||||
"properties": {
|
||||
"className": {
|
||||
"description": "Class Name for authorizer.",
|
||||
"type": "string"
|
||||
},
|
||||
"containerRequestFilter": {
|
||||
"description": "Filter for the request authorization",
|
||||
"type": "string"
|
||||
},
|
||||
"adminPrincipals": {
|
||||
"description": "List of unique admin principals",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"botPrincipals": {
|
||||
"description": "List of unique bot principals",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"principalDomain": {
|
||||
"description": "Principal Domain",
|
||||
"type": "string"
|
||||
},
|
||||
"enforcePrincipalDomain": {
|
||||
"description": "Enable Enforce Principal Domain",
|
||||
"type": "boolean"
|
||||
},
|
||||
"enableSecureSocketConnection": {
|
||||
"description": "Enable Secure Socket Connection",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": ["className", "containerRequestFilter", "adminPrincipals", "botPrincipals", "principalDomain", "enforcePrincipalDomain", "enableSecureSocketConnection"],
|
||||
"additionalProperties": false
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
{
|
||||
"$id": "https://open-metadata.org/schema/entity/configuration/elasticSearchConfiguration.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "ElasticSearchConfiguration",
|
||||
"description": "This schema defines the Elastic Search Configuration.",
|
||||
"type": "object",
|
||||
"javaType": "org.openmetadata.catalog.elasticsearch.ElasticSearchConfiguration",
|
||||
"properties": {
|
||||
"host": {
|
||||
"description": "Elastic Search Host",
|
||||
"type": "string"
|
||||
},
|
||||
"port": {
|
||||
"description": "Elastic Search port",
|
||||
"type": "integer"
|
||||
},
|
||||
"scheme": {
|
||||
"description": "Http/Https connection scheme",
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"description": "Elastic Search Username for Login",
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"description": "Elastic Search Password for Login",
|
||||
"type": "string"
|
||||
},
|
||||
"truststorePath": {
|
||||
"description": "Truststore Path",
|
||||
"type": "string"
|
||||
},
|
||||
"truststorePassword": {
|
||||
"description": "Truststore Password",
|
||||
"type": "string"
|
||||
},
|
||||
"connectionTimeoutSecs": {
|
||||
"description": "Connection Timeout in Seconds",
|
||||
"type": "integer",
|
||||
"default": 5
|
||||
},
|
||||
"socketTimeoutSecs": {
|
||||
"description": "Socket Timeout in Seconds",
|
||||
"type": "integer",
|
||||
"default": 60
|
||||
},
|
||||
"batchSize": {
|
||||
"description": "Batch Size for Requests",
|
||||
"type": "integer",
|
||||
"default": 10
|
||||
}
|
||||
},
|
||||
"required": ["host", "port", "scheme", "connectionTimeoutSecs", "socketTimeoutSecs", "batchSize"],
|
||||
"additionalProperties": false
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"$id": "https://open-metadata.org/schema/entity/configuration/eventHandlerConfiguration.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "EventHandlerConfiguration",
|
||||
"description": "This schema defines the Event Handler Configuration.",
|
||||
"type": "object",
|
||||
"javaType": "org.openmetadata.catalog.events.EventHandlerConfiguration",
|
||||
"properties": {
|
||||
"eventHandlerClassNames": {
|
||||
"description": "Event Handler Class Names",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["eventHandlerClassNames"],
|
||||
"additionalProperties": false
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
{
|
||||
"$id": "https://open-metadata.org/schema/entity/configuration/fernetConfiguration.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "FernetConfiguration",
|
||||
"description": "This schema defines the Fernet Configuration.",
|
||||
"type": "object",
|
||||
"javaType": "org.openmetadata.catalog.fernet.FernetConfiguration",
|
||||
"properties": {
|
||||
"fernetKey": {
|
||||
"description": "Fernet Key",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["fernetKey"],
|
||||
"additionalProperties": false
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
{
|
||||
"$id": "https://open-metadata.org/schema/entity/configuration/jwtTokenConfiguration.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "JWTTokenConfiguration",
|
||||
"description": "This schema defines the JWT Configuration.",
|
||||
"type": "object",
|
||||
"javaType": "org.openmetadata.catalog.security.jwt.JWTTokenConfiguration",
|
||||
"properties": {
|
||||
"rsapublicKeyFilePath": {
|
||||
"description": "RSA Public Key File Path",
|
||||
"type": "string"
|
||||
},
|
||||
"rsaprivateKeyFilePath": {
|
||||
"description": "RSA Private Key File Path",
|
||||
"type": "string"
|
||||
},
|
||||
"jwtissuer": {
|
||||
"description": "JWT Issuer",
|
||||
"type": "string"
|
||||
},
|
||||
"keyId": {
|
||||
"description": "Key ID",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["jwtissuer", "keyId"],
|
||||
"additionalProperties": false
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
{
|
||||
"$id": "https://open-metadata.org/schema/entity/configuration/slackChatConfiguration.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "SlackChatConfiguration",
|
||||
"description": "This schema defines the Slack Chat Configuration.",
|
||||
"type": "object",
|
||||
"javaType": "org.openmetadata.catalog.slackChat.SlackChatConfiguration",
|
||||
"properties": {
|
||||
"apiToken": {
|
||||
"description": "Api Token",
|
||||
"type": "string"
|
||||
},
|
||||
"botName": {
|
||||
"description": "Bot Name",
|
||||
"type": "string"
|
||||
},
|
||||
"channels": {
|
||||
"description": "Slack Chat Channels",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": null
|
||||
}
|
||||
},
|
||||
"required": ["apiToken", "botName", "channels"],
|
||||
"additionalProperties": false
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
{
|
||||
"$id": "https://open-metadata.org/schema/entity/configuration/slackEventPubConfiguration.json",
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "SlackPublisherConfiguration",
|
||||
"description": "This schema defines the Authentication Configuration.",
|
||||
"type": "object",
|
||||
"javaType": "org.openmetadata.catalog.slack.SlackPublisherConfiguration",
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "Publisher Name",
|
||||
"type": "string"
|
||||
},
|
||||
"webhookUrl": {
|
||||
"description": "Webhook URL",
|
||||
"type": "string"
|
||||
},
|
||||
"openMetadataUrl": {
|
||||
"description": "OpenMetadata URL",
|
||||
"type": "string"
|
||||
},
|
||||
"filters": {
|
||||
"description": "Filters",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "../type/changeEvent.json#/definitions/eventFilter"
|
||||
},
|
||||
"default": null
|
||||
},
|
||||
"batchSize": {
|
||||
"description": "Batch Size",
|
||||
"type": "integer",
|
||||
"default": 10
|
||||
}
|
||||
},
|
||||
"required": ["name", "filters"],
|
||||
"additionalProperties": false
|
||||
}
|
@ -58,14 +58,26 @@ class ConfigResourceTest extends CatalogApplicationTest {
|
||||
void get_auth_configs_200_OK() throws IOException {
|
||||
WebTarget target = getConfigResource("auth");
|
||||
AuthenticationConfiguration auth = TestUtils.get(target, AuthenticationConfiguration.class, TEST_AUTH_HEADERS);
|
||||
assertEquals(config.getAuthenticationConfiguration().toString(), auth.toString());
|
||||
assertEquals(config.getAuthenticationConfiguration().getProvider(), auth.getProvider());
|
||||
assertEquals(config.getAuthenticationConfiguration().getProviderName(), auth.getProviderName());
|
||||
assertEquals(config.getAuthenticationConfiguration().getAuthority(), auth.getAuthority());
|
||||
assertEquals(config.getAuthenticationConfiguration().getCallbackUrl(), auth.getCallbackUrl());
|
||||
assertEquals(config.getAuthenticationConfiguration().getJwtPrincipalClaims(), auth.getJwtPrincipalClaims());
|
||||
assertEquals(config.getAuthenticationConfiguration().getClientId(), auth.getClientId());
|
||||
}
|
||||
|
||||
@Test
|
||||
void get_authorizer_configs_200_OK() throws IOException {
|
||||
WebTarget target = getConfigResource("authorizer");
|
||||
AuthorizerConfiguration auth = TestUtils.get(target, AuthorizerConfiguration.class, TEST_AUTH_HEADERS);
|
||||
assertEquals(config.getAuthorizerConfiguration().toString(), auth.toString());
|
||||
assertEquals(config.getAuthorizerConfiguration().getClassName(), auth.getClassName());
|
||||
assertEquals(config.getAuthorizerConfiguration().getPrincipalDomain(), auth.getPrincipalDomain());
|
||||
assertEquals(config.getAuthorizerConfiguration().getAdminPrincipals(), auth.getAdminPrincipals());
|
||||
assertEquals(config.getAuthorizerConfiguration().getBotPrincipals(), auth.getBotPrincipals());
|
||||
assertEquals(config.getAuthorizerConfiguration().getContainerRequestFilter(), auth.getContainerRequestFilter());
|
||||
assertEquals(
|
||||
config.getAuthorizerConfiguration().getEnableSecureSocketConnection(), auth.getEnableSecureSocketConnection());
|
||||
assertEquals(config.getAuthorizerConfiguration().getEnforcePrincipalDomain(), auth.getEnforcePrincipalDomain());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -36,12 +36,11 @@ public class JWTTokenGeneratorTest {
|
||||
@BeforeAll
|
||||
public void setup(TestInfo test) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {
|
||||
jwtTokenConfiguration = new JWTTokenConfiguration();
|
||||
jwtTokenConfiguration.setJWTIssuer("open-metadata.org");
|
||||
jwtTokenConfiguration.setRSAPrivateKeyFilePath(rsaPrivateKeyPath);
|
||||
jwtTokenConfiguration.setRSAPublicKeyFilePath(rsaPublicKeyPath);
|
||||
jwtTokenConfiguration.setJwtissuer("open-metadata.org");
|
||||
jwtTokenConfiguration.setRsaprivateKeyFilePath(rsaPrivateKeyPath);
|
||||
jwtTokenConfiguration.setRsapublicKeyFilePath(rsaPublicKeyPath);
|
||||
jwtTokenGenerator = JWTTokenGenerator.getInstance();
|
||||
jwtTokenGenerator.init(jwtTokenConfiguration);
|
||||
;
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -71,7 +70,7 @@ public class JWTTokenGeneratorTest {
|
||||
private DecodedJWT decodedJWT(String token) {
|
||||
RSAPublicKey publicKey = jwtTokenGenerator.getPublicKey();
|
||||
Algorithm algorithm = Algorithm.RSA256(publicKey, null);
|
||||
JWTVerifier verifier = JWT.require(algorithm).withIssuer(jwtTokenConfiguration.getJWTIssuer()).build();
|
||||
JWTVerifier verifier = JWT.require(algorithm).withIssuer(jwtTokenConfiguration.getJwtissuer()).build();
|
||||
return verifier.verify(token);
|
||||
}
|
||||
}
|
||||
|
@ -137,10 +137,16 @@ authorizerConfiguration:
|
||||
|
||||
authenticationConfiguration:
|
||||
provider: "openID"
|
||||
publicKey: "https://www.googleapis.com/oauth2/v3/certs"
|
||||
providerName: ""
|
||||
publicKeyUrls:
|
||||
- "https://www.googleapis.com/oauth2/v3/certs"
|
||||
authority: "https://accounts.google.com"
|
||||
clientId: "261867039324-neb92r2147i6upchb78tv29idk079bps.apps.googleusercontent.com"
|
||||
callbackUrl: "http://localhost:8585/callback"
|
||||
jwtPrincipalClaims:
|
||||
- "email"
|
||||
- "preferred_username"
|
||||
- "sub"
|
||||
|
||||
jwtTokenConfiguration:
|
||||
rsapublicKeyFilePath: "src/test/resources/public_key.der"
|
||||
|
Loading…
x
Reference in New Issue
Block a user