Class PrincipalNameGeneratorImpl
- java.lang.Object
-
- org.apache.sling.jackrabbit.usermanager.impl.post.PrincipalNameGeneratorImpl
-
- All Implemented Interfaces:
PrincipalNameGenerator
public class PrincipalNameGeneratorImpl extends Object implements PrincipalNameGenerator
Default implementation that generates a principal name based on a set of well-known request parametersThe 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 Modifier and Type Class Description static interface
PrincipalNameGeneratorImpl.Config
-
Nested classes/interfaces inherited from interface org.apache.sling.jackrabbit.usermanager.PrincipalNameGenerator
PrincipalNameGenerator.NameInfo
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_MAX_NAME_LENGTH
-
Constructor Summary
Constructors Constructor Description PrincipalNameGeneratorImpl()
PrincipalNameGeneratorImpl(String[] parameterNames, int maxNameLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activate(PrincipalNameGeneratorImpl.Config config)
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 requestprotected String
getValueToUse(Map<String,?> parameters, String paramName)
Determine the value to use for the specified parameter.protected @NotNull List<String>
valueToList(Object value)
Convert the value to a list of strings
-
-
-
Field Detail
-
DEFAULT_MAX_NAME_LENGTH
public static final int DEFAULT_MAX_NAME_LENGTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PrincipalNameGeneratorImpl
public PrincipalNameGeneratorImpl()
-
PrincipalNameGeneratorImpl
public PrincipalNameGeneratorImpl(String[] parameterNames, int maxNameLength)
-
-
Method Detail
-
activate
protected void activate(PrincipalNameGeneratorImpl.Config config)
-
valueToList
@NotNull protected @NotNull List<String> valueToList(Object value)
Convert the value to a list of strings
-
getValueToUse
protected String getValueToUse(Map<String,?> parameters, String paramName)
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:
request
- requesttype
- the type of principaldefaultPrincipalNameGenerator
- the default principal name generator- Returns:
- the principal name to be created or null if other PrincipalNameGenerators should be consulted
-
-