Skip to content

[#10966] feat(authn): Add built-in IdP model#11022

Open
lasdf1234 wants to merge 9 commits into
apache:mainfrom
lasdf1234:add-built-in-idp-model
Open

[#10966] feat(authn): Add built-in IdP model#11022
lasdf1234 wants to merge 9 commits into
apache:mainfrom
lasdf1234:add-built-in-idp-model

Conversation

@lasdf1234
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR adds the built-in IdP API model classes under the plugins:idp-basic module, including DTOs, requests, responses, and their unit tests.

Why are the changes needed?

The built-in IdP management work needs its API model classes to live with the idp-basic plugin instead of introducing them in broader shared modules.

Fix: #10966

Does this PR introduce any user-facing change?

No.

How was this patch tested?

./gradlew :plugins:idp-basic:test \
  --tests org.apache.gravitino.idp.basic.dto.TestIdpUserDTO \
  --tests org.apache.gravitino.idp.basic.dto.TestIdpGroupDTO \
  --tests org.apache.gravitino.idp.basic.dto.requests.TestCreateUserRequest \
  --tests org.apache.gravitino.idp.basic.dto.requests.TestCreateGroupRequest \
  --tests org.apache.gravitino.idp.basic.dto.requests.TestResetPasswordRequest \
  --tests org.apache.gravitino.idp.basic.dto.requests.TestUpdateGroupUsersRequest \
  --tests org.apache.gravitino.idp.basic.dto.responses.TestIdpUserResponse \
  --tests org.apache.gravitino.idp.basic.dto.responses.TestIdpGroupResponse \
  -PskipWeb=true

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 10, 2026 10:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces the API model layer for the built-in IdP feature within the plugins:idp-basic module, including DTOs, REST request/response objects, and focused unit tests to validate JSON (de)serialization and input validation behavior.

Changes:

  • Added built-in IdP DTOs for users and groups (IdpUserDTO, IdpGroupDTO).
  • Added request/response model classes for user/group operations (create user/group, reset password, update group users).
  • Added unit tests covering SerDe, validation, and ensuring password fields are not exposed via toString(); updated module dependencies accordingly.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
plugins/idp-basic/src/main/java/org/apache/gravitino/idp/basic/dto/IdpUserDTO.java Adds user DTO with builder and JSON annotations.
plugins/idp-basic/src/main/java/org/apache/gravitino/idp/basic/dto/IdpGroupDTO.java Adds group DTO with builder and JSON annotations.
plugins/idp-basic/src/main/java/org/apache/gravitino/idp/basic/dto/requests/CreateUserRequest.java Adds create-user request model with validation and password redaction in toString().
plugins/idp-basic/src/main/java/org/apache/gravitino/idp/basic/dto/requests/CreateGroupRequest.java Adds create-group request model with validation.
plugins/idp-basic/src/main/java/org/apache/gravitino/idp/basic/dto/requests/ResetPasswordRequest.java Adds reset-password request model with validation and password redaction in toString().
plugins/idp-basic/src/main/java/org/apache/gravitino/idp/basic/dto/requests/UpdateGroupUsersRequest.java Adds group-membership update request model with validation.
plugins/idp-basic/src/main/java/org/apache/gravitino/idp/basic/dto/responses/IdpUserResponse.java Adds user response wrapper with validation.
plugins/idp-basic/src/main/java/org/apache/gravitino/idp/basic/dto/responses/IdpGroupResponse.java Adds group response wrapper with validation.
plugins/idp-basic/src/test/java/org/apache/gravitino/idp/basic/dto/TestIdpUserDTO.java Tests user DTO JSON SerDe and builder validation.
plugins/idp-basic/src/test/java/org/apache/gravitino/idp/basic/dto/TestIdpGroupDTO.java Tests group DTO JSON SerDe and builder validation.
plugins/idp-basic/src/test/java/org/apache/gravitino/idp/basic/dto/requests/TestCreateUserRequest.java Tests create-user request SerDe/validate and password non-exposure via toString().
plugins/idp-basic/src/test/java/org/apache/gravitino/idp/basic/dto/requests/TestCreateGroupRequest.java Tests create-group request SerDe and validation.
plugins/idp-basic/src/test/java/org/apache/gravitino/idp/basic/dto/requests/TestResetPasswordRequest.java Tests reset-password request SerDe/validate and password non-exposure via toString().
plugins/idp-basic/src/test/java/org/apache/gravitino/idp/basic/dto/requests/TestUpdateGroupUsersRequest.java Tests update-group-users request SerDe and validation.
plugins/idp-basic/src/test/java/org/apache/gravitino/idp/basic/dto/responses/TestIdpUserResponse.java Tests user response SerDe and validation error messaging.
plugins/idp-basic/src/test/java/org/apache/gravitino/idp/basic/dto/responses/TestIdpGroupResponse.java Tests group response SerDe and validation error messaging.
plugins/idp-basic/build.gradle.kts Adds required dependencies (common module, Jackson, Lombok) to support new API models and tests.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

@github-actions
Copy link
Copy Markdown

Code Coverage Report

Overall Project 66.03% +0.05% 🟢
Files changed 96.75% 🟢

Module Coverage
aliyun 1.73% 🔴
api 47.13% 🟢
authorization-common 85.96% 🟢
aws 1.1% 🔴
azure 2.6% 🔴
catalog-common 10.2% 🔴
catalog-fileset 80.02% 🟢
catalog-glue 82.47% 🟢
catalog-hive 81.83% 🟢
catalog-jdbc-clickhouse 79.18% 🟢
catalog-jdbc-common 43.93% 🟢
catalog-jdbc-doris 80.28% 🟢
catalog-jdbc-hologres 54.03% 🟢
catalog-jdbc-mysql 79.23% 🟢
catalog-jdbc-oceanbase 78.38% 🟢
catalog-jdbc-postgresql 82.05% 🟢
catalog-jdbc-starrocks 78.27% 🟢
catalog-kafka 77.01% 🟢
catalog-lakehouse-generic 45.14% 🟢
catalog-lakehouse-hudi 79.1% 🟢
catalog-lakehouse-iceberg 87.08% 🟢
catalog-lakehouse-paimon 77.48% 🟢
catalog-model 77.72% 🟢
cli 44.51% 🟢
client-java 77.96% 🟢
common 50.01% 🟢
core 82.27% 🟢
filesystem-hadoop3 76.97% 🟢
flink 42.54% 🟢
flink-runtime 0.0% 🔴
gcp 14.2% 🔴
hadoop-common 10.39% 🔴
hive-metastore-common 46.83% 🟢
iceberg-common 55.24% 🟢
iceberg-rest-server 68.93% 🟢
idp-basic 95.85% +1.17% 🟢
integration-test-common 0.0% 🔴
jobs 66.17% 🟢
lance-common 19.95% 🔴
lance-rest-server 62.78% 🟢
lineage 53.02% 🟢
optimizer 82.95% 🟢
optimizer-api 21.95% 🔴
server 85.78% 🟢
server-common 71.21% 🟢
spark 32.79% 🔴
spark-common 39.09% 🔴
trino-connector 35.14% 🔴
Files
Module File Coverage
idp-basic IdpGroupDTO.java 100.0% 🟢
IdpUserDTO.java 100.0% 🟢
CreateUserRequest.java 100.0% 🟢
ResetPasswordRequest.java 100.0% 🟢
UpdateGroupUsersRequest.java 93.33% 🟢
IdpGroupResponse.java 92.86% 🟢
IdpUserResponse.java 92.86% 🟢
CreateGroupRequest.java 91.67% 🟢

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lasdf1234
Copy link
Copy Markdown
Contributor Author

@roryqi The CI process has been successfully completed. If you have time, please review it for me. Thank you.

@roryqi
Copy link
Copy Markdown
Contributor

roryqi commented May 11, 2026

I will suggest reviewing storage pull request first.

@ToString
@Builder
@Jacksonized
public class CreateGroupRequest implements RESTRequest {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could u use AddGroupRequest?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got I have modified

@ToString
@Builder
@Jacksonized
public class CreateUserRequest implements RESTRequest {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could u use AddUserRequest?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got I have modified

@ToString
@Builder
@Jacksonized
public class UpdateGroupUsersRequest implements RESTRequest {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could u use GroupMembershipChangeRequest?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got I have added GroupAddUsersRequest

import org.apache.commons.lang3.StringUtils;

/** Represents a built-in IdP group Data Transfer Object (DTO). */
@EqualsAndHashCode
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could u use builder annotation here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got It has been supplemented.

@ToString
@Builder
@Jacksonized
public class UpdateGroupUsersRequest implements RESTRequest {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could we remove users?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got I have added GroupRemoveUsersRequest

lasdf1234 and others added 4 commits May 11, 2026 15:44
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lasdf1234
Copy link
Copy Markdown
Contributor Author

@roryqi All the codes have been modified according to the suggestions. If you have the time, could you please review the code for me?

@lasdf1234 lasdf1234 requested a review from roryqi May 11, 2026 08:08

/** The interface of a built-in IdP user. */
@Evolving
public interface IdpUser {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this interfaces?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has no practical use. The project contains some DTO classes and uses interfaces. If it is not necessary, interface can be removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @roryqi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't put plugin classes into api module. API module is visible to users. Users shouldn't know these concepts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got, I have deleted two interfaces. cc @roryqi

@lasdf1234 lasdf1234 requested a review from roryqi May 11, 2026 09:38
@lasdf1234
Copy link
Copy Markdown
Contributor Author

@roryqi All the codes have been revised. If you have time, please review them for me. Thank you.

}

dependencies {
implementation(project(":common"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could u add a blank line here? Because next line belongs the different segment.


dependencies {
implementation(project(":common"))
implementation(libs.bcprov.jdk18on)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could u follow the alphabet order here?

implementation(libs.guava)
implementation(libs.jackson.annotations)
implementation(libs.jackson.databind)
annotationProcessor(libs.lombok)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does lombok repeat for many times? Is it required?

@ToString
@Builder
@Jacksonized
public class GroupRemoveUsersRequest implements RESTRequest {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have concern about this class. I don't we should have this request. I prefer using

GroupMembershipChangeRequest {
   String[] additions;
   String[] removals;
}

But we can see the next pull request.

I also don't like the order you raised the pull requests.

You raise the storage pull request first.
Then logic layer pull request.
Finally API layer pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Subtask] Add build-in Idp model

3 participants