Class FromAttributesAuthorizationGenerator
- java.lang.Object
-
- org.pac4j.core.authorization.generator.FromAttributesAuthorizationGenerator
-
- All Implemented Interfaces:
AuthorizationGenerator
public class FromAttributesAuthorizationGenerator extends java.lang.Object implements AuthorizationGenerator
Generate the authorization information by inspecting attributes.
The attributes containing the roles separated by the
splitChar
property (can be set throughsetSplitChar(String)
) are defined in the constructor. It's the same for the attributes containing the permissions.- Since:
- 1.5.0
- Author:
- Jerome Leleu
-
-
Constructor Summary
Constructors Constructor Description FromAttributesAuthorizationGenerator()
FromAttributesAuthorizationGenerator(java.lang.String[] roleAttributes, java.lang.String[] permissionAttributes)
FromAttributesAuthorizationGenerator(java.util.Collection<java.lang.String> roleAttributes, java.util.Collection<java.lang.String> permissionAttributes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<UserProfile>
generate(WebContext context, SessionStore sessionStore, UserProfile profile)
Generate the authorization information from and for the user profile.java.lang.String
getSplitChar()
void
setPermissionAttributes(java.lang.String permissionAttributesStr)
void
setRoleAttributes(java.lang.String roleAttributesStr)
void
setSplitChar(java.lang.String splitChar)
-
-
-
Constructor Detail
-
FromAttributesAuthorizationGenerator
public FromAttributesAuthorizationGenerator()
-
FromAttributesAuthorizationGenerator
public FromAttributesAuthorizationGenerator(java.util.Collection<java.lang.String> roleAttributes, java.util.Collection<java.lang.String> permissionAttributes)
-
FromAttributesAuthorizationGenerator
public FromAttributesAuthorizationGenerator(java.lang.String[] roleAttributes, java.lang.String[] permissionAttributes)
-
-
Method Detail
-
generate
public java.util.Optional<UserProfile> generate(WebContext context, SessionStore sessionStore, UserProfile profile)
Description copied from interface:AuthorizationGenerator
Generate the authorization information from and for the user profile.- Specified by:
generate
in interfaceAuthorizationGenerator
- Parameters:
context
- the web contextsessionStore
- the session storeprofile
- the user profile for which to generate the authorization information.- Returns:
- the updated profile or a new one (optional)
-
getSplitChar
public java.lang.String getSplitChar()
-
setSplitChar
public void setSplitChar(java.lang.String splitChar)
-
setRoleAttributes
public void setRoleAttributes(java.lang.String roleAttributesStr)
-
setPermissionAttributes
public void setPermissionAttributes(java.lang.String permissionAttributesStr)
-
-