Class PrincipalNameGeneratorImpl
java.lang.Object
org.apache.sling.jackrabbit.usermanager.impl.post.PrincipalNameGeneratorImpl
- All Implemented Interfaces:
PrincipalNameGenerator
Default implementation that generates a principal name based on a set of
well-known request parameters
The value is resolved by the locating the first request parameter that is a match of one of the choices in the following order:
- ":name" - value is the exact name to use
- ":name@ValueFrom" - value is the name of another submitted parameter whose value is the exact name to use
- ":nameHint" - value is filtered, trimmed and made unique
- ":nameHint@ValueFrom" - value is the name of another submitted parameter whose value is filtered, trimmed and made unique
- otherwise, try the value of any configured "principalNameHints" parameters to treat as a hint that is filtered, trimmed and made unique
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.sling.jackrabbit.usermanager.PrincipalNameGenerator
PrincipalNameGenerator.NameInfo
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
getPrincipalName
(Map<String, ?> parameters, org.apache.jackrabbit.oak.spi.security.user.AuthorizableType type, PrincipalNameFilter principalNameFilter, PrincipalNameGenerator defaultPrincipalNameGenerator) Get a "nice" principal name, if possible, based on given requestprotected String
getValueToUse
(Map<String, ?> parameters, String paramName) Determine the value to use for the specified parameter.valueToList
(Object value) Convert the value to a list of strings
-
Field Details
-
DEFAULT_MAX_NAME_LENGTH
public static final int DEFAULT_MAX_NAME_LENGTH- See Also:
-
-
Constructor Details
-
PrincipalNameGeneratorImpl
public PrincipalNameGeneratorImpl() -
PrincipalNameGeneratorImpl
-
-
Method Details
-
activate
-
valueToList
Convert the value to a list of strings -
getValueToUse
Determine the value to use for the specified parameter. This also considers the parameter with aSlingPostConstants.VALUE_FROM_SUFFIX
- Parameters:
parameters
- the map of request parametersparamName
- the parameter to get the value for- Returns:
- the value to use for the parameter or null if it could not be determined
-
getPrincipalName
public PrincipalNameGenerator.NameInfo getPrincipalName(Map<String, ?> parameters, org.apache.jackrabbit.oak.spi.security.user.AuthorizableType type, PrincipalNameFilter principalNameFilter, PrincipalNameGenerator defaultPrincipalNameGenerator) Get a "nice" principal name, if possible, based on given request- Specified by:
getPrincipalName
in interfacePrincipalNameGenerator
- Parameters:
parameters
- the properties to consider when generating a nametype
- the type of principalprincipalNameFilter
- the filter to make a value work as a principal namedefaultPrincipalNameGenerator
- the default principal name generator- Returns:
- the principal name to be created or null if other PrincipalNameGenerators should be consulted
-