Class SecurityUtils
java.lang.Object
com.flowable.core.spring.security.SecurityUtils
- Author:
- Filip Hrisafov, Joram Barrez
-
Method Summary
Modifier and TypeMethodDescriptionstatic GrantedAuthority
createGroupAuthority
(String groupKey) static GrantedAuthority
createTenantAuthority
(String tenantId) static GrantedAuthority
createUserDefinitionAuthority
(String userDefinitionKey) static boolean
currentUserHasAdminRights
(PlatformSecurityInterceptor platformSecurityInterceptor, String[] additionalAdminUsers) static boolean
currentUserHasAuthority
(String authority) Deprecated.static boolean
currentUserHasGroup
(String group) Deprecated.use theSecurityScope.getGroupKeys()
obtained viagetCurrentUserSecurityScope()
to check insteadstatic boolean
currentUserIsSuperAdmin
(PlatformSecurityInterceptor platformSecurityInterceptor, String[] additionalAdminUsers) A super admin is an admin user in the default tenant.static boolean
currentUserIsTenantAdmin
(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 String
extractTenantIdFromAuthorities
(Collection<? extends GrantedAuthority> authorities) static String
extractUserDefinitionKeyFromAuthorities
(Collection<? extends GrantedAuthority> authorities) static String
Deprecated.use theSecurityScope.getTenantId()
obtained viagetCurrentUserSecurityScope()
insteadDeprecated.use theSecurityScope.getGroupKeys()
obtained viagetCurrentUserSecurityScope()
insteadstatic String
Deprecated.use theSecurityScope.getUserId()
obtained viagetCurrentUserSecurityScope()
insteadstatic SecurityScope
static SecurityScope
Equivalent togetCurrentUserSecurityScope()
, but returns null instead of throwing an exception when no authentication has been set.static SecurityScope
getSecurityScope
(Authentication authentication) static void
setSecurityScopeProvider
(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
SecurityScope
containing, amongst others, the current user id and tenant ID. AnIllegalStateException
is 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