@Service(value="blAdminSecurityRemoteService") public class AdminSecurityServiceRemote extends Object implements AdminSecurityService, SecurityVerifier
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AdminSecurityServiceRemote.CrumbRelationship
How a section crumb's entity relates to the next entity inwards.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
ANONYMOUS_USER_NAME |
protected Map<String,Set<AdminSecurityServiceRemote.CrumbRelationship>> |
crumbRelationshipCache
Resolved
AdminSecurityServiceRemote.CrumbRelationships keyed by "parentClass->childClass". |
protected ExploitProtectionService |
exploitProtectionService |
protected static int |
MAX_CRUMB_RELATIONSHIP_CACHE_SIZE
Defensive ceiling on
crumbRelationshipCache. |
protected RowLevelSecurityService |
rowLevelSecurityService |
protected AdminSecurityService |
securityService |
| Constructor and Description |
|---|
AdminSecurityServiceRemote() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
findRelationships(javax.persistence.metamodel.Metamodel metamodel,
javax.persistence.metamodel.ManagedType<?> type,
Class<?> child,
Set<AdminSecurityServiceRemote.CrumbRelationship> found,
Set<Class<?>> visitedEmbeddables) |
AdminUser |
getAdminUser() |
protected Set<AdminSecurityServiceRemote.CrumbRelationship> |
getCrumbRelationships(String parent,
String child) |
AdminUser |
getPersistentAdminUser() |
protected List<String> |
getRelatedSectionCrumbCeilings(PersistencePackage persistencePackage,
EntityOperationType operationType)
Returns the section crumb entities that may additionally authorize this request.
|
protected boolean |
hasToOne(javax.persistence.metamodel.Metamodel metamodel,
Class<?> entity,
Class<?> child) |
protected boolean |
isCrumbHopAllowed(AdminSecurityServiceRemote.CrumbRelationship relationship,
boolean readOnly,
boolean finalHop,
boolean adornedRequest)
Whether one hop of the crumb chain may authorize the operation.
|
protected boolean |
isReadOperation(EntityOperationType operationType) |
protected boolean |
isRelated(Class<?> mapped,
Class<?> child) |
protected boolean |
isSameEntity(String parent,
String child) |
protected Set<AdminSecurityServiceRemote.CrumbRelationship> |
resolveCrumbRelationships(String parent,
String child)
Determines from the JPA metamodel every kind of relationship any polymorphic implementation of
parent
has to child (an entity can have several, e.g. |
void |
securityCheck(PersistencePackage persistencePackage,
EntityOperationType operationType) |
protected void |
securityCheck(String[] ceilingNames,
EntityOperationType operationType) |
void |
securityCheck(String ceilingEntityFullyQualifiedName,
EntityOperationType operationType) |
public static final String ANONYMOUS_USER_NAME
protected AdminSecurityService securityService
protected ExploitProtectionService exploitProtectionService
protected RowLevelSecurityService rowLevelSecurityService
protected static final int MAX_CRUMB_RELATIONSHIP_CACHE_SIZE
crumbRelationshipCache. Crumb identifiers are validated against the admin
section / persistable-entity whitelist before they reach this service, so the key space is already bounded in
practice; this cap guarantees the cache cannot grow without bound regardless of how it is populated.protected final Map<String,Set<AdminSecurityServiceRemote.CrumbRelationship>> crumbRelationshipCache
AdminSecurityServiceRemote.CrumbRelationships keyed by "parentClass->childClass". Entity mappings don't change at runtime,
so entries never need eviction for correctness; MAX_CRUMB_RELATIONSHIP_CACHE_SIZE only bounds growth.public AdminUser getAdminUser() throws ServiceException
getAdminUser in interface AdminSecurityServiceServiceExceptionpublic AdminUser getPersistentAdminUser()
getPersistentAdminUser in interface SecurityVerifierpublic void securityCheck(PersistencePackage persistencePackage, EntityOperationType operationType) throws ServiceException
securityCheck in interface SecurityVerifierServiceExceptionpublic void securityCheck(String ceilingEntityFullyQualifiedName, EntityOperationType operationType) throws ServiceException
securityCheck in interface SecurityVerifierServiceExceptionprotected void securityCheck(String[] ceilingNames, EntityOperationType operationType) throws ServiceException
ServiceExceptionprotected List<String> getRelatedSectionCrumbCeilings(PersistencePackage persistencePackage, EntityOperationType operationType)
sectionCrumbs come straight from the client, so a crumb must never authorize a target it has nothing to
do with (otherwise a permission on any one entity becomes a permission on every entity). A crumb only counts when
the request target is genuinely reachable from it through mapped JPA relationships. Starting from the innermost
crumb, each crumb must reach the next one inwards (and the innermost one the target) as allowed by
isCrumbHopAllowed(org.broadleafcommerce.openadmin.server.security.remote.AdminSecurityServiceRemote.CrumbRelationship, boolean, boolean, boolean); the walk stops at the first crumb that doesn't, so neither an unrelated crumb nor
anything in front of it is used.
This keeps the legitimate uses of crumbs working: editing an entity's own collections (Product -> Skus), nested collection modals (Product -> Sku -> Sku media), adorned target collections (Product -> categories via CategoryProductXref) and read-only to-one lookups (Product.defaultCategory -> Category).
protected boolean isCrumbHopAllowed(AdminSecurityServiceRemote.CrumbRelationship relationship, boolean readOnly, boolean finalHop, boolean adornedRequest)
finalHop - whether this hop reaches the request's own target (as opposed to a crumb nested inside it)adornedRequest - whether the server built this package for an adorned target collectionprotected boolean isReadOperation(EntityOperationType operationType)
protected Set<AdminSecurityServiceRemote.CrumbRelationship> getCrumbRelationships(String parent, String child)
protected Set<AdminSecurityServiceRemote.CrumbRelationship> resolveCrumbRelationships(String parent, String child)
parent
has to child (an entity can have several, e.g. Product has both the to-one defaultCategory and
the allParentCategoryXrefs join collection to Category). Anything that can't be resolved (non-entity
ceilings, unknown classes) yields an empty set, i.e. the crumb is not trusted.protected void findRelationships(javax.persistence.metamodel.Metamodel metamodel,
javax.persistence.metamodel.ManagedType<?> type,
Class<?> child,
Set<AdminSecurityServiceRemote.CrumbRelationship> found,
Set<Class<?>> visitedEmbeddables)
protected boolean hasToOne(javax.persistence.metamodel.Metamodel metamodel,
Class<?> entity,
Class<?> child)
Copyright © 2026. All rights reserved.