bharos commented on code in PR #10503: URL: https://github.com/apache/gravitino/pull/10503#discussion_r2985553513
########## core/src/main/java/org/apache/gravitino/auth/GroupMapper.java: ########## @@ -0,0 +1,40 @@ +/* + * 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.gravitino.auth; + +import java.util.List; +import org.apache.gravitino.UserGroup; + +/** + * Interface for mapping authenticated groups. + * + * <p>Implementations should be thread-safe as they may be shared across multiple authentication + * requests. + */ +public interface GroupMapper { Review Comment: Hmm, I don't have a strong preference. To keep consistency of naming we can maybe keep RegexpGroupMapper .. ########## docs/security/how-to-authenticate.md: ########## @@ -134,6 +189,30 @@ gravitino.authenticator.oauth.principalMapper.regex.pattern = ([^@]+)@.* gravitino.authenticator.oauth.principalMapper = com.example.MyCustomMapper Review Comment: nit : make the class name same as MyCustomPrincipalMapper example below ########## docs/security/how-to-authenticate.md: ########## @@ -208,9 +287,12 @@ Gravitino server and Gravitino Iceberg REST server share the same configuration | `gravitino.authenticator.oauth.scope` | OAuth scopes for Web UI authentication (space-separated). | (none) | Yes if provider is `oidc` | 1.0.0 | | `gravitino.authenticator.oauth.jwksUri` | JWKS URI for server-side OAuth token validation. Required when using JWKS-based validation. | (none) | Yes if `tokenValidatorClass` is `org.apache.gravitino.server.authentication.JwksTokenValidator` | 1.0.0 | | `gravitino.authenticator.oauth.principalFields` | JWT claim field(s) to use as principal identity. Comma-separated list for fallback in order (e.g., 'preferred_username,email,sub'). | `sub` | No | 1.0.0 | +| `gravitino.authenticator.oauth.groupsFields` | JWT claim field(s) to use as group membership. Comma-separated list for fallback in order (e.g., 'groups,roles'). | (none) | No | 1.2.0 | | `gravitino.authenticator.oauth.tokenValidatorClass` | Fully qualified class name of the OAuth token validator implementation. Use `org.apache.gravitino.server.authentication.JwksTokenValidator` for JWKS-based validation or `org.apache.gravitino.server.authentication.StaticSignKeyValidator` for static key validation. | `org.apache.gravitino.server.authentication.StaticSignKeyValidator` | No | 1.0.0 | | `gravitino.authenticator.oauth.principalMapper` | Principal mapper type for OAuth. Use 'regex' for regex-based mapping, or provide a fully qualified class name implementing `org.apache.gravitino.auth.PrincipalMapper`. | `regex` | No | 1.2.0 | | `gravitino.authenticator.oauth.principalMapper.regex.pattern` | Regex pattern for OAuth principal mapping. First capture group becomes the mapped principal. Only used when principalMapper is 'regex'. | `^(.*)$` | No | 1.2.0 | +| `gravitino.authenticator.oauth.groupMapper` | Group mapper type for OAuth. Use 'regex' for regex-based mapping, or provide a fully qualified class name implementing `org.apache.gravitino.auth.GroupMapper`. | `regex` | No | 1.2.0 | Review Comment: Should we be putting these versions as 1.3.0 (same in other places in doc) -- 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]
