jerqi commented on code in PR #9788: URL: https://github.com/apache/gravitino/pull/9788#discussion_r2731555124
########## core/src/main/java/org/apache/gravitino/auth/KerberosPrincipalParser.java: ########## @@ -0,0 +1,214 @@ +/* + * 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.Objects; +import java.util.Optional; + +/** + * Utility for parsing Kerberos principal strings into structured components. + * + * <p>A Kerberos principal has the format: {@code primary[/instance][@REALM]} where: + * + * <ul> + * <li><b>primary</b> (required): The primary component, typically the user or service name + * <li><b>instance</b> (optional): The secondary component, often a hostname for service + * principals + * <li><b>realm</b> (optional): The Kerberos realm (domain), typically uppercase + * </ul> + * + * <p>Examples: + * + * <ul> + * <li>{@code john} - primary only + * <li>{@code [email protected]} - primary with realm + * <li>{@code HTTP/[email protected]} - service principal with instance and realm + * </ul> + */ +public class KerberosPrincipalParser { Review Comment: KerberosPrincipalParser mixed two concepts KerberosPrincipal and KerberosPrincipalMapper. We should implement a KerberosPrincipalMapper and a KerberosPrincipal here. ``` class KerberosPrincipalMapper implement PrincipalMapper { Principal map(String principal) { return new KerberosPrincipal(xxx, xxxx, xxx); } } class KerberosPrincipal implement Principal { Optional<String> getName(); Optional<String> getRealm(); Optional<String> getInstance(); } ``` -- 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]
