collado-mike commented on code in PR #499: URL: https://github.com/apache/polaris/pull/499#discussion_r1874106077
########## polaris-service/src/main/java/org/apache/polaris/service/auth/AuthenticatedPolarisPrincipalImpl.java: ########## @@ -0,0 +1,49 @@ +/* + * 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.polaris.service.auth; + +import java.util.Set; +import org.apache.polaris.core.auth.AuthenticatedPolarisPrincipal; + +public final class AuthenticatedPolarisPrincipalImpl implements AuthenticatedPolarisPrincipal { + private final long id; + private final String name; + private final Set<String> roles; + + public AuthenticatedPolarisPrincipalImpl(long id, String name, Set<String> roles) { Review Comment: > Again, the authenticator can validate the claims but does not have to resolve role names to Polaris IDs. > We may need another component to deal specifically with mapping external roles / principals to Polaris entities. This is fine, but right now, that work is being done by the Authenticator + the Resolver and I think that's the wrong separation. The Authenticator today doesn't validate the content of the scopes at all - that's left to the resolver and is only supported by Grant records. This means that it's not enough to add a user to a group in the 3P IdP, but the user must also be added to the group via the Polaris API so that the requisite grant record exists. Today, the Polaris `/tokens` endpoint doesn't validate the contents of the `scopes` claim when it generates the token. We can fix this and then the Authenticator doesn't need to do the work of validating the contents of the token. But we'd still need the Resolver to trust the contents of the `AuthenticatedPolarisPrincipal`'s `activePrincipalRoleNames` list and resolve the PrincipalRoles without looking for associated grant records. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
