xujiantop-crypto opened a new pull request, #14098:
URL: https://github.com/apache/cloudstack/pull/14098

   ### Description
   
   On a user's first LDAP login, `getActiveUserAccount` returns `null` before 
`loginUser` authenticates the LDAP user and creates the CloudStack user. After 
the successful login, the OAuth login-detail cleanup dereferences that stale 
`null` value and turns the successful login into an NPE.
   
   Only remove the OAuth login detail when the user already existed before 
authentication. A newly created LDAP user cannot have that pre-existing detail, 
so its successful login response is now returned normally.
   
   Fixes #14095
   
   ### Testing
   
   Added 
`DefaultLoginAPIAuthenticatorCmdTest.testAuthenticateFirstLdapLoginWithoutExistingUser`
 to reproduce the first-login flow and verify that OAuth-detail cleanup is 
skipped for a user that did not exist before LDAP authentication.
   
   ```text
   mvn -pl server -am -Dtest=DefaultLoginAPIAuthenticatorCmdTest 
-Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false test
   ```
   
   Result: 1 test passed; all 26 reactor modules succeeded; Checkstyle reported 
0 violations.


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