Class ClassNameRequestParamValidationServiceImpl
java.lang.Object
org.broadleafcommerce.openadmin.security.ClassNameRequestParamValidationServiceImpl
- All Implemented Interfaces:
ClassNameRequestParamValidationService
@Service("blClassNameRequestParamValidationService")
public class ClassNameRequestParamValidationServiceImpl
extends Object
implements ClassNameRequestParamValidationService
- Author:
- Jeff Fischer
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AdminNavigationServiceprotected jakarta.persistence.EntityManagerFactoryprotected DynamicDaoHelperprotected PersistenceService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetClassNameForSection(String sectionKey) Retrieve a fully qualified classname using a sectionKey.getSectionCrumbs(String crumbList) Retrieve a list of section crumbs given a delimited string (usually harvested from the "sectionCrumbs" param on a Http request).booleanvalidateClassNameParams(Map<String, String> requestParamToClassName, String persistenceUnitName) Compare a map of request params to fully qualified classname values against the whitelist.
-
Field Details
-
factory
protected jakarta.persistence.EntityManagerFactory factory -
persistenceService
-
helper
-
-
Constructor Details
-
ClassNameRequestParamValidationServiceImpl
public ClassNameRequestParamValidationServiceImpl()
-
-
Method Details
-
validateClassNameParams
public boolean validateClassNameParams(Map<String, String> requestParamToClassName, String persistenceUnitName) Description copied from interface:ClassNameRequestParamValidationServiceCompare a map of request params to fully qualified classname values against the whitelist.- Specified by:
validateClassNameParamsin interfaceClassNameRequestParamValidationService- Parameters:
requestParamToClassName- a map of request params and associated fully qualified classnames to confirm against the whitelistpersistenceUnitName- the persistence unit the white list is generated from- Returns:
- whether or not the map of values is valid
-
getClassNameForSection
Description copied from interface:ClassNameRequestParamValidationServiceRetrieve a fully qualified classname using a sectionKey. Will return the passed in sectionKey if not classname is registered for it in the datastore. Since it's possible for no classname to be registered and for the key to be a fully qualified classname itself, any unmatched sectionKey is confirmed against the whitelist. If found to be not valid, aSectionKeyValidationExceptioninstance is thrown. If thrown from within a Spring MVC controller, this exception will result in an Http 404 status code back to the requester.- Specified by:
getClassNameForSectionin interfaceClassNameRequestParamValidationService- Parameters:
sectionKey- the sectionKey used to retrieve the fully qualified classname- Returns:
- the fully qualified classname associated with the sectionKey, or the sectionKey itself if no match is found
-
getSectionCrumbs
Description copied from interface:ClassNameRequestParamValidationServiceRetrieve a list of section crumbs given a delimited string (usually harvested from the "sectionCrumbs" param on a Http request). The SectionCrumb instances contains sectionKey information, and are therefore susceptible to the same validation requirements asClassNameRequestParamValidationService.getClassNameForSection(String). If a sectionKey is found to be not valid, aSectionKeyValidationExceptioninstance is thrown. If thrown from within a Spring MVC controller, this exception will result in an Http 404 status code back to the requester.- Specified by:
getSectionCrumbsin interfaceClassNameRequestParamValidationService- Parameters:
crumbList- the delimited string (related to the "sectionCrumbs" param in an Http request)- Returns:
- the list of section crumbs representing the currently active admin sections for a given request
-