Browse Source

[Fix-14811][fix] Fix when using Casdoor SSO, ldap, OAuth2 to log in, the tenant problem of not specifying the currently logged in user (#14812)

3.2.1-prepare
gaopeng 1 year ago committed by GitHub
parent
commit
5062aa12da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoginController.java
  2. 3
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java

3
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/LoginController.java

@ -31,6 +31,7 @@ import org.apache.dolphinscheduler.api.service.SessionService;
import org.apache.dolphinscheduler.api.service.UsersService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.OkHttpUtils;
import org.apache.dolphinscheduler.dao.entity.User;
@ -241,7 +242,7 @@ public class LoginController extends BaseController {
String username = JSONUtils.getNodeString(userInfoJsonStr, "login");
User user = usersService.getUserByUserName(username);
if (user == null) {
user = usersService.createUser(username, null, null, 0, null, null, 1);
user = usersService.createUser(UserType.GENERAL_USER, username, null);
}
String sessionId = sessionService.createSession(user, null);
if (sessionId == null) {

3
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/UsersServiceImpl.java

@ -224,7 +224,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService {
}
/***
* create User for ldap and sso login
* create User for ldapCasdoor SSO and OAuth2.0 login
*/
@Override
@Transactional
@ -238,6 +238,7 @@ public class UsersServiceImpl extends BaseServiceImpl implements UsersService {
user.setUserType(userType);
user.setCreateTime(now);
user.setUpdateTime(now);
user.setTenantId(-1);
user.setQueue("");
user.setState(Flag.YES.getCode());

Loading…
Cancel
Save