Class SecurityUtils
java.lang.Object
com.flowable.core.spring.security.SecurityUtils
- Author:
- Filip Hrisafov, Joram Barrez
-
Method Summary
Modifier and TypeMethodDescriptionstatic GrantedAuthoritycreateGroupAuthority(String groupKey) static GrantedAuthoritycreateTenantAuthority(String tenantId) static GrantedAuthoritycreateUserDefinitionAuthority(String userDefinitionKey) static booleancurrentUserHasAdminRights(PlatformSecurityInterceptor platformSecurityInterceptor, String[] additionalAdminUsers) static booleancurrentUserHasAuthority(String authority) Deprecated.static booleancurrentUserHasGroup(String group) Deprecated.use theSecurityScope.getGroupKeys()obtained viagetCurrentUserSecurityScope()to check insteadstatic booleancurrentUserIsSuperAdmin(PlatformSecurityInterceptor platformSecurityInterceptor, String[] additionalAdminUsers) A super admin is an admin user in the default tenant.static booleancurrentUserIsTenantAdmin(PlatformSecurityInterceptor platformSecurityInterceptor, String[] additionalAdminUsers, String tenantId) A tenant admin is an admin user in its own tenant or a super adminextractGroupsFromAuthorities(Collection<? extends GrantedAuthority> authorities) static StringextractTenantIdFromAuthorities(Collection<? extends GrantedAuthority> authorities) static StringextractUserDefinitionKeyFromAuthorities(Collection<? extends GrantedAuthority> authorities) static StringDeprecated.use theSecurityScope.getTenantId()obtained viagetCurrentUserSecurityScope()insteadDeprecated.use theSecurityScope.getGroupKeys()obtained viagetCurrentUserSecurityScope()insteadstatic StringDeprecated.use theSecurityScope.getUserId()obtained viagetCurrentUserSecurityScope()insteadstatic SecurityScopestatic SecurityScopeEquivalent togetCurrentUserSecurityScope(), but returns null instead of throwing an exception when no authentication has been set.static SecurityScopegetSecurityScope(Authentication authentication) static voidsetSecurityScopeProvider(SecurityScopeProvider securityScopeProvider)
-
Method Details
-
setSecurityScopeProvider
-
createTenantAuthority
-
createGroupAuthority
-
createUserDefinitionAuthority
-
extractUserDefinitionKeyFromAuthorities
public static String extractUserDefinitionKeyFromAuthorities(Collection<? extends GrantedAuthority> authorities) -
extractTenantIdFromAuthorities
public static String extractTenantIdFromAuthorities(Collection<? extends GrantedAuthority> authorities) -
extractGroupsFromAuthorities
public static Set<String> extractGroupsFromAuthorities(Collection<? extends GrantedAuthority> authorities) -
getCurrentUserId
Deprecated.use theSecurityScope.getUserId()obtained viagetCurrentUserSecurityScope()instead -
getCurrentTenantId
Deprecated.use theSecurityScope.getTenantId()obtained viagetCurrentUserSecurityScope()instead -
currentUserHasAdminRights
public static boolean currentUserHasAdminRights(PlatformSecurityInterceptor platformSecurityInterceptor, String[] additionalAdminUsers) -
currentUserIsTenantAdmin
public static boolean currentUserIsTenantAdmin(PlatformSecurityInterceptor platformSecurityInterceptor, String[] additionalAdminUsers, String tenantId) A tenant admin is an admin user in its own tenant or a super admin -
currentUserIsSuperAdmin
public static boolean currentUserIsSuperAdmin(PlatformSecurityInterceptor platformSecurityInterceptor, String[] additionalAdminUsers) A super admin is an admin user in the default tenant. -
getCurrentUserGroupKeys
Deprecated.use theSecurityScope.getGroupKeys()obtained viagetCurrentUserSecurityScope()instead -
currentUserHasGroup
Deprecated.use theSecurityScope.getGroupKeys()obtained viagetCurrentUserSecurityScope()to check instead -
currentUserHasAuthority
Deprecated.use theSecurityScope.hasAuthority(String)obtained viagetCurrentUserSecurityScope()instead -
getCurrentUserSecurityScope
- Returns:
- The current
SecurityScopecontaining, amongst others, the current user id and tenant ID. AnIllegalStateExceptionis thrown when no authentication is set (e.g. when calling the java api programmatically without wrapping it in a command context block). Alternatively, usegetCurrentUserSecurityScopeSafe()when null should be returned instead of throwing the exception.
-
getCurrentUserSecurityScopeSafe
Equivalent togetCurrentUserSecurityScope(), but returns null instead of throwing an exception when no authentication has been set. -
getSecurityScope
-
SecurityScope.hasAuthority(String)obtained viagetCurrentUserSecurityScope()instead