package ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
import ;
/**
* 说明:重构流程编辑器获取用户信息
* 作者:FH Admin
* from:
*/
public class SecurityUtils {
private static User assumeUser;
private static SecurityScopeProvider securityScopeProvider = new FlowableSecurityScopeProvider();
private SecurityUtils() {
}
/**
* Get the login of the current user.
*/
public static String getCurrentUserId() {
User user = getCurrentUserObject();
if (user != null) {
return ();
}
return null;
}
/**
* @return the {@link User} object associated with the current logged in user.
*/
public static User getCurrentUserObject() {
if (assumeUser != null) {
return assumeUser;
}
RemoteUser user = new RemoteUser();
(());
(());
(());
(());
("admin@");
("123456");
List<String> pris = new ArrayList<>();
(DefaultPrivileges.ACCESS_MODELER);
(DefaultPrivileges.ACCESS_IDM);
(DefaultPrivileges.ACCESS_ADMIN);
(DefaultPrivileges.ACCESS_TASK);
(DefaultPrivileges.ACCESS_REST_API);
(pris);
return user;
}
public static void setSecurityScopeProvider(SecurityScopeProvider securityScopeProvider) {
= securityScopeProvider;
}
public static SecurityScope getCurrentSecurityScope() {
SecurityContext securityContext = ();
if (securityContext != null && () != null) {
return getSecurityScope(());
}
return null;
}
public static SecurityScope getSecurityScope(Authentication authentication) {
return (authentication);
}
public static SecurityScope getAuthenticatedSecurityScope() {
SecurityScope currentSecurityScope = getCurrentSecurityScope();
if (currentSecurityScope != null) {
return currentSecurityScope;
}
throw new FlowableIllegalStateException("User is not authenticated");
}
public static void assumeUser(User user) {
assumeUser = user;
}
public static void clearAssumeUser() {
assumeUser = null;
}
}