@@ -37,23 +37,8 @@ pub const OPA_TLS_VOLUME_NAME: &str = "opa-tls";
3737
3838pub struct HiveOpaConfig {
3939 /// Endpoint for OPA, e.g.
40- /// `http://localhost:8081/v1/data/hms/allow `
40+ /// `http://localhost:8081/v1/data/<package> `
4141 pub ( crate ) base_endpoint : String ,
42- /// Policy to check database authorization, e.g.
43- /// `http://localhost:8081/v1/data/hms/database_allow`
44- pub ( crate ) policy_url_database : String ,
45- /// Policy to check table authorization, e.g.
46- /// `http://localhost:8081/v1/data/hms/table_allow`
47- pub ( crate ) policy_url_table : String ,
48- /// Policy to check column authorization, e.g.
49- /// `http://localhost:8081/v1/data/hms/column_allow`
50- pub ( crate ) policy_url_column : String ,
51- /// Policy to check partition authorization, e.g.
52- /// `http://localhost:8081/v1/data/hms/partition_allow`
53- pub ( crate ) policy_url_partition : String ,
54- /// Policy to check user authorization, e.g.
55- /// `http://localhost:8081/v1/data/hms/user_allow`
56- pub ( crate ) policy_url_user : String ,
5742 /// Optional TLS secret class for OPA communication.
5843 /// If set, the CA certificate from this secret class will be added
5944 /// to hive's truststore to make it trust OPA's TLS certificate.
@@ -67,40 +52,8 @@ impl HiveOpaConfig {
6752 opa_config : & OpaConfig ,
6853 ) -> Result < Self , stackable_operator:: commons:: opa:: Error > {
6954 // See: https://github.com/boschglobal/hive-metastore-opa-authorizer?tab=readme-ov-file#configuration
70- // TODO: get document root once (client call) and build the other strings
7155 let base_endpoint = opa_config
72- . full_document_url_from_config_map ( client, hive, Some ( "allow" ) , OpaApiVersion :: V1 )
73- . await ?;
74-
75- let policy_url_database = opa_config
76- . full_document_url_from_config_map (
77- client,
78- hive,
79- Some ( "database_allow" ) ,
80- OpaApiVersion :: V1 ,
81- )
82- . await ?;
83- let policy_url_table = opa_config
84- . full_document_url_from_config_map ( client, hive, Some ( "table_allow" ) , OpaApiVersion :: V1 )
85- . await ?;
86- let policy_url_column = opa_config
87- . full_document_url_from_config_map (
88- client,
89- hive,
90- Some ( "column_allow" ) ,
91- OpaApiVersion :: V1 ,
92- )
93- . await ?;
94- let policy_url_partition = opa_config
95- . full_document_url_from_config_map (
96- client,
97- hive,
98- Some ( "partition_allow" ) ,
99- OpaApiVersion :: V1 ,
100- )
101- . await ?;
102- let policy_url_user = opa_config
103- . full_document_url_from_config_map ( client, hive, Some ( "user_allow" ) , OpaApiVersion :: V1 )
56+ . full_document_url_from_config_map ( client, hive, None , OpaApiVersion :: V1 )
10457 . await ?;
10558
10659 let tls_secret_class = client
@@ -115,11 +68,6 @@ impl HiveOpaConfig {
11568
11669 Ok ( HiveOpaConfig {
11770 base_endpoint,
118- policy_url_database,
119- policy_url_table,
120- policy_url_column,
121- policy_url_partition,
122- policy_url_user,
12371 tls_secret_class,
12472 } )
12573 }
@@ -152,23 +100,23 @@ impl HiveOpaConfig {
152100 ) ,
153101 (
154102 OPA_AUTHORIZATION_POLICY_URL_DATA_BASE . to_string ( ) ,
155- self . policy_url_database . to_owned ( ) ,
103+ "database_allow" . to_string ( ) ,
156104 ) ,
157105 (
158106 OPA_AUTHORIZATION_POLICY_URL_TABLE . to_string ( ) ,
159- self . policy_url_table . to_owned ( ) ,
107+ "table_allow" . to_string ( ) ,
160108 ) ,
161109 (
162110 OPA_AUTHORIZATION_POLICY_URL_COLUMN . to_string ( ) ,
163- self . policy_url_column . to_owned ( ) ,
111+ "column_allow" . to_string ( ) ,
164112 ) ,
165113 (
166114 OPA_AUTHORIZATION_POLICY_URL_PARTITION . to_string ( ) ,
167- self . policy_url_partition . to_owned ( ) ,
115+ "partition_allow" . to_string ( ) ,
168116 ) ,
169117 (
170118 OPA_AUTHORIZATION_POLICY_URL_USER . to_string ( ) ,
171- self . policy_url_user . to_owned ( ) ,
119+ "user_allow" . to_string ( ) ,
172120 ) ,
173121 ] )
174122 }
0 commit comments