Class FromAttributesAuthorizationGenerator
java.lang.Object
org.pac4j.core.authorization.generator.FromAttributesAuthorizationGenerator
- All Implemented Interfaces:
AuthorizationGenerator
Generate the authorization information by inspecting attributes.
The attributes containing the roles separated by the splitChar
property (can be set through setSplitChar(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
ConstructorDescriptionFromAttributesAuthorizationGenerator
(String[] roleAttributes, String[] permissionAttributes) FromAttributesAuthorizationGenerator
(Collection<String> roleAttributes, Collection<String> permissionAttributes) -
Method Summary
Modifier and TypeMethodDescriptiongenerate
(WebContext context, SessionStore sessionStore, UserProfile profile) Generate the authorization information from and for the user profile.void
setPermissionAttributes
(String permissionAttributesStr) void
setRoleAttributes
(String roleAttributesStr) void
setSplitChar
(String splitChar)
-
Constructor Details
-
FromAttributesAuthorizationGenerator
public FromAttributesAuthorizationGenerator() -
FromAttributesAuthorizationGenerator
public FromAttributesAuthorizationGenerator(Collection<String> roleAttributes, Collection<String> permissionAttributes) -
FromAttributesAuthorizationGenerator
-
-
Method Details
-
generate
public 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
-
setSplitChar
-
setRoleAttributes
-
setPermissionAttributes
-