amogh-jahagirdar commented on code in PR #10621: URL: https://github.com/apache/iceberg/pull/10621#discussion_r1664893504
########## core/src/main/java/org/apache/iceberg/rest/auth/AuthSession.java: ########## @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.iceberg.rest.auth; + +import java.util.Map; + +public interface AuthSession { + + Map<String, String> headers(); Review Comment: Yeah for this to work with SigV4 you'll need all these details. Broadly, seems like there's 2 approaches, either define a higher level abstraction which will have these details (basically pulling out the relevant parts from the request like the header, query params, body, etc), like the current approach or lower the abstraction and use the `CredentialsProvider` API that's already exposed on the HTTP client (that was originally intended for proxy connections but it's worth considering if we should add a generic API for specifying credentials provider). ########## core/src/main/java/org/apache/iceberg/rest/auth/AuthManager.java: ########## @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.iceberg.rest.auth; + +import java.util.Map; +import java.util.function.Supplier; +import org.apache.iceberg.rest.RESTClient; +import org.apache.iceberg.util.Pair; + +public interface AuthManager extends AutoCloseable { + + Map<String, String> mergeAuthHeadersForGetConfig( + RESTClient initialAuthClient, Map<String, String> configuredHeaders); + + AuthSession newSession( + RESTClient authClient, Map<String, String> mergedProps, Map<String, String> baseHeaders); + + Pair<String, Supplier<AuthSession>> newSessionSupplier( + Map<String, String> credentials, Map<String, String> properties, AuthSession parent); + + void initialize(String managerName, Map<String, String> properties); Review Comment: What's the point of having a `managerName`? ########## core/src/main/java/org/apache/iceberg/rest/auth/AuthManager.java: ########## @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.iceberg.rest.auth; + +import java.util.Map; +import java.util.function.Supplier; +import org.apache.iceberg.rest.RESTClient; +import org.apache.iceberg.util.Pair; + +public interface AuthManager extends AutoCloseable { + + Map<String, String> mergeAuthHeadersForGetConfig( Review Comment: Yeah @jackye1995 I'm not sure there really needs to be a separate mergeAuthHeadersForGetConfig API. Feels like the `newSession` API should do all that in the implementation? ########## core/src/main/java/org/apache/iceberg/rest/auth/AuthManager.java: ########## @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.iceberg.rest.auth; + +import java.util.Map; +import java.util.function.Supplier; +import org.apache.iceberg.rest.RESTClient; +import org.apache.iceberg.util.Pair; + +public interface AuthManager extends AutoCloseable { + + Map<String, String> mergeAuthHeadersForGetConfig( Review Comment: @adutra Isn't that the purpose of the `newSession` API? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org