Class DefaultRolesAuthorizationGenerator

java.lang.Object
org.pac4j.core.authorization.generator.DefaultRolesAuthorizationGenerator
All Implemented Interfaces:
AuthorizationGenerator

public class DefaultRolesAuthorizationGenerator extends Object implements AuthorizationGenerator
Grant default roles to a user profile.
Since:
1.8.0
Author:
Jerome Leleu
  • Constructor Details

    • DefaultRolesAuthorizationGenerator

      public DefaultRolesAuthorizationGenerator()

      Constructor for DefaultRolesAuthorizationGenerator.

    • DefaultRolesAuthorizationGenerator

      public DefaultRolesAuthorizationGenerator(Collection<String> defaultRoles)

      Constructor for DefaultRolesAuthorizationGenerator.

      Parameters:
      defaultRoles - a Collection object
    • DefaultRolesAuthorizationGenerator

      public DefaultRolesAuthorizationGenerator(String[] defaultRoles)

      Constructor for DefaultRolesAuthorizationGenerator.

      Parameters:
      defaultRoles - an array of String objects
  • Method Details

    • generate

      public Optional<UserProfile> generate(CallContext ctx, UserProfile profile)
      Generate the authorization information from and for the user profile.
      Specified by:
      generate in interface AuthorizationGenerator
      Parameters:
      ctx - the current context
      profile - the user profile for which to generate the authorization information.
      Returns:
      the updated profile or a new one (optional)
    • setDefaultRoles

      public void setDefaultRoles(String defaultRolesStr)
      Setter for defaultRoles
      Parameters:
      defaultRolesStr - a coma-separated string of role names