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 AdminNavigationService
protected jakarta.persistence.EntityManagerFactory
protected DynamicDaoHelper
protected 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).boolean
validateClassNameParams
(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:ClassNameRequestParamValidationService
Compare a map of request params to fully qualified classname values against the whitelist.- Specified by:
validateClassNameParams
in 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:ClassNameRequestParamValidationService
Retrieve 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, aSectionKeyValidationException
instance 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:
getClassNameForSection
in 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:ClassNameRequestParamValidationService
Retrieve 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, aSectionKeyValidationException
instance 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:
getSectionCrumbs
in 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
-