Class FromAttributesAuthorizationGenerator

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

public class FromAttributesAuthorizationGenerator extends Object implements AuthorizationGenerator

Generate the authorization information by inspecting attributes.

The attributes containing the roles separated by the splitChar property are defined in the constructor.

Since:
1.5.0
Author:
Jerome Leleu
  • Constructor Details

    • FromAttributesAuthorizationGenerator

      public FromAttributesAuthorizationGenerator()

      Constructor for FromAttributesAuthorizationGenerator.

    • FromAttributesAuthorizationGenerator

      public FromAttributesAuthorizationGenerator(Collection<String> roleAttributes)

      Constructor for FromAttributesAuthorizationGenerator.

      Parameters:
      roleAttributes - a Collection object
    • FromAttributesAuthorizationGenerator

      public FromAttributesAuthorizationGenerator(String[] roleAttributes)

      Constructor for FromAttributesAuthorizationGenerator.

      Parameters:
      roleAttributes - 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)