lasdf1234 commented on code in PR #11226:
URL: https://github.com/apache/gravitino/pull/11226#discussion_r3309955824
##########
plugins/idp-basic/src/main/java/org/apache/gravitino/idp/IdpUserGroupManager.java:
##########
@@ -100,6 +127,27 @@ public IdpUser getUser(String username) {
return new IdpUser(userPO.getUsername(),
USER_SERVICE.listGroupNamesByUsername(username));
}
+ /**
+ * Authenticates a built-in IdP user with the given plaintext password.
+ *
+ * @param username The username.
+ * @param password The plaintext password.
+ * @return The authenticated user with group memberships, or {@code null}
when credentials are
+ * invalid.
+ */
+ @Nullable
+ public IdpUser authenticate(String username, String password) {
+ try {
+ IdpUserPO userPO = USER_SERVICE.getIdpUserByUsername(username);
+ if (!passwordHasher.verify(password, userPO.getPasswordHash())) {
+ return null;
+ }
+ return new IdpUser(username,
USER_SERVICE.listGroupNamesByUsername(username));
+ } catch (NotFoundException e) {
Review Comment:
Got resovled
--
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]