arshadmohammad commented on code in PR #245:
URL: https://github.com/apache/seatunnel-web/pull/245#discussion_r1894234813


##########
seatunnel-server/seatunnel-app/src/main/java/org/apache/seatunnel/app/service/impl/UserServiceImpl.java:
##########
@@ -160,10 +165,38 @@ public UserSimpleInfoRes login(UserLoginReq req) {
                         .userId(user.getId())
                         .build();
         userDaoImpl.insertLoginLog(logDto);
-
         return translate;
     }
 
+    private User ldapAuthentication(UserLoginReq req) {
+        String username = req.getUsername();
+        String password = req.getPassword();
+        Authentication authenticationRequest =
+                new UsernamePasswordAuthenticationToken(username, password);
+        try {
+            
configuredAuthenticationProvider.authenticate(authenticationRequest);
+        } catch (AuthenticationException ex) {
+            throw new SeatunnelException(USERNAME_PASSWORD_NO_MATCHED);
+        }
+
+        if (userDaoImpl.getByName(username) == null) {
+            // 2. add a new user.
+            final UpdateUserDto dto =
+                    
UpdateUserDto.builder().id(null).username(username).password("").build();
+            userDaoImpl.add(dto);

Review Comment:
   After the first login, an LDAP user is added to the database. From the 
second login onwards, the same user can log in as a DB_USER by just not 
providing Auth-Type header.
   There should be a way to differentiate between user types.



-- 
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]

Reply via email to