mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 10:39:30 +00:00 
			
		
		
		
	Added enum for ssl and auth (#11016)
This commit is contained in:
		
							parent
							
								
									ae6683862f
								
							
						
					
					
						commit
						1b930fa6f7
					
				| @ -44,7 +44,7 @@ def get_connection_url(connection: HiveConnection) -> str: | |||||||
|     if ( |     if ( | ||||||
|         connection.username |         connection.username | ||||||
|         and connection.auth |         and connection.auth | ||||||
|         and connection.auth in ("LDAP", "CUSTOM") |         and connection.auth.value in ("LDAP", "CUSTOM") | ||||||
|     ): |     ): | ||||||
|         url += quote_plus(connection.username) |         url += quote_plus(connection.username) | ||||||
|         if not connection.password: |         if not connection.password: | ||||||
| @ -80,7 +80,7 @@ def get_connection(connection: HiveConnection) -> Engine: | |||||||
|     if connection.auth: |     if connection.auth: | ||||||
|         if not connection.connectionArguments: |         if not connection.connectionArguments: | ||||||
|             connection.connectionArguments = init_empty_connection_arguments() |             connection.connectionArguments = init_empty_connection_arguments() | ||||||
|         connection.connectionArguments.__root__["auth"] = connection.auth |         connection.connectionArguments.__root__["auth"] = connection.auth.value | ||||||
| 
 | 
 | ||||||
|     if connection.kerberosServiceName: |     if connection.kerberosServiceName: | ||||||
|         if not connection.connectionArguments: |         if not connection.connectionArguments: | ||||||
|  | |||||||
| @ -22,6 +22,7 @@ from metadata.generated.schema.entity.automations.workflow import ( | |||||||
| ) | ) | ||||||
| from metadata.generated.schema.entity.services.connections.database.postgresConnection import ( | from metadata.generated.schema.entity.services.connections.database.postgresConnection import ( | ||||||
|     PostgresConnection, |     PostgresConnection, | ||||||
|  |     SslMode, | ||||||
| ) | ) | ||||||
| from metadata.ingestion.connections.builders import ( | from metadata.ingestion.connections.builders import ( | ||||||
|     create_generic_db_connection, |     create_generic_db_connection, | ||||||
| @ -45,7 +46,11 @@ def get_connection(connection: PostgresConnection) -> Engine: | |||||||
|     if connection.sslMode: |     if connection.sslMode: | ||||||
|         if not connection.connectionArguments: |         if not connection.connectionArguments: | ||||||
|             connection.connectionArguments = init_empty_connection_arguments() |             connection.connectionArguments = init_empty_connection_arguments() | ||||||
|         connection.connectionArguments.__root__["sslmode"] = connection.sslMode |         connection.connectionArguments.__root__["sslmode"] = connection.sslMode.value | ||||||
|  |         if connection.sslMode in (SslMode.verify_ca, SslMode.verify_full): | ||||||
|  |             connection.connectionArguments.__root__[ | ||||||
|  |                 "sslrootcert" | ||||||
|  |             ] = connection.sslConfig.__root__.certificatePath | ||||||
|     return create_generic_db_connection( |     return create_generic_db_connection( | ||||||
|         connection=connection, |         connection=connection, | ||||||
|         get_connection_url_fn=get_connection_url_common, |         get_connection_url_fn=get_connection_url_common, | ||||||
|  | |||||||
| @ -21,6 +21,7 @@ from metadata.generated.schema.entity.automations.workflow import ( | |||||||
| ) | ) | ||||||
| from metadata.generated.schema.entity.services.connections.database.redshiftConnection import ( | from metadata.generated.schema.entity.services.connections.database.redshiftConnection import ( | ||||||
|     RedshiftConnection, |     RedshiftConnection, | ||||||
|  |     SslMode, | ||||||
| ) | ) | ||||||
| from metadata.ingestion.connections.builders import ( | from metadata.ingestion.connections.builders import ( | ||||||
|     create_generic_db_connection, |     create_generic_db_connection, | ||||||
| @ -44,7 +45,11 @@ def get_connection(connection: RedshiftConnection) -> Engine: | |||||||
|     if connection.sslMode: |     if connection.sslMode: | ||||||
|         if not connection.connectionArguments: |         if not connection.connectionArguments: | ||||||
|             connection.connectionArguments = init_empty_connection_arguments() |             connection.connectionArguments = init_empty_connection_arguments() | ||||||
|         connection.connectionArguments.__root__["sslmode"] = connection.sslMode |         connection.connectionArguments.__root__["sslmode"] = connection.sslMode.value | ||||||
|  |         if connection.sslMode in (SslMode.verify_ca, SslMode.verify_full): | ||||||
|  |             connection.connectionArguments.__root__[ | ||||||
|  |                 "sslrootcert" | ||||||
|  |             ] = connection.sslConfig.__root__.certificatePath | ||||||
|     return create_generic_db_connection( |     return create_generic_db_connection( | ||||||
|         connection=connection, |         connection=connection, | ||||||
|         get_connection_url_fn=get_connection_url_common, |         get_connection_url_fn=get_connection_url_common, | ||||||
|  | |||||||
| @ -50,8 +50,10 @@ | |||||||
|     }, |     }, | ||||||
|     "auth": { |     "auth": { | ||||||
|       "title": "Authentication Mode", |       "title": "Authentication Mode", | ||||||
|       "description": "Authentication mode to connect to hive, E.g, LDAP, CUSTOM etc", |       "description": "Authentication mode to connect to hive.", | ||||||
|       "type": "string" |       "type": "string", | ||||||
|  |       "enum": ["NONE", "LDAP", "KERBEROS", "CUSTOM", "NOSASL", "BASIC"], | ||||||
|  |       "default": "NONE" | ||||||
|     }, |     }, | ||||||
|     "kerberosServiceName": { |     "kerberosServiceName": { | ||||||
|       "title": "Kerberos Service Name", |       "title": "Kerberos Service Name", | ||||||
|  | |||||||
| @ -55,8 +55,12 @@ | |||||||
|     }, |     }, | ||||||
|     "sslMode": { |     "sslMode": { | ||||||
|       "title": "SSL Mode", |       "title": "SSL Mode", | ||||||
|       "description": "SSL Mode to connect to postgres database. E.g, prefer, verify-ca etc.", |       "description": "SSL Mode to connect to postgres database.", | ||||||
|       "type": "string" |       "enum": ["disable", "allow", "prefer", "require", "verify-ca", "verify-full"], | ||||||
|  |       "default": "disable" | ||||||
|  |     }, | ||||||
|  |     "sslConfig": { | ||||||
|  |       "$ref": "../../../../security/ssl/verifySSLConfig.json#/definitions/sslConfig" | ||||||
|     }, |     }, | ||||||
|     "classificationName": { |     "classificationName": { | ||||||
|       "title": "Classification Name", |       "title": "Classification Name", | ||||||
|  | |||||||
| @ -61,8 +61,12 @@ | |||||||
|     }, |     }, | ||||||
|     "sslMode": { |     "sslMode": { | ||||||
|       "title": "SSL Mode", |       "title": "SSL Mode", | ||||||
|       "description": "SSL Mode to connect to postgres database. E.g, prefer, verify-ca etc.", |       "description": "SSL Mode to connect to redshift database.", | ||||||
|       "type": "string" |       "enum": ["disable", "allow", "prefer", "require", "verify-ca", "verify-full"], | ||||||
|  |       "default": "disable" | ||||||
|  |     }, | ||||||
|  |     "sslConfig": { | ||||||
|  |       "$ref": "../../../../security/ssl/verifySSLConfig.json#/definitions/sslConfig" | ||||||
|     }, |     }, | ||||||
|     "connectionOptions": { |     "connectionOptions": { | ||||||
|       "title": "Connection Options", |       "title": "Connection Options", | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ | |||||||
|   "javaType": "org.openmetadata.schema.security.ssl.ValidateSSLClientConfig", |   "javaType": "org.openmetadata.schema.security.ssl.ValidateSSLClientConfig", | ||||||
|   "properties": { |   "properties": { | ||||||
|     "certificatePath": { |     "certificatePath": { | ||||||
|       "description": "CA certificate path. E.g., /path/to/public.cert. Will be used if Verify SSL is set to `validate`.", |       "description": "CA certificate path. E.g., /path/to/public.cert. Will be used if Verify SSL is set to `validate` or `verify`.", | ||||||
|       "type": "string" |       "type": "string" | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Onkar Ravgan
						Onkar Ravgan