Class RoleConfigurator

java.lang.Object
org.jgrapes.core.internal.ComponentVertex
org.jgrapes.core.Component
org.jgrapes.webconsole.rbac.RoleConfigurator
All Implemented Interfaces:
Iterable<org.jgrapes.core.ComponentType>, org.jgrapes.core.Channel, org.jgrapes.core.ComponentType, org.jgrapes.core.Eligible, org.jgrapes.core.Manager

public class RoleConfigurator extends org.jgrapes.core.Component
Configures roles (of type {@link ConsoleRole)} for the user currently logged in.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.jgrapes.core.Channel

    org.jgrapes.core.Channel.Default
  • Field Summary

    Fields inherited from class org.jgrapes.core.Component

    logger

    Fields inherited from interface org.jgrapes.core.Channel

    BROADCAST, SELF
  • Constructor Summary

    Constructors
    Constructor
    Description
    RoleConfigurator(org.jgrapes.core.Channel componentChannel)
    Creates a new component with its channel set to the given channel.
    RoleConfigurator(org.jgrapes.core.Channel componentChannel, Map<?,?> properties)
    Creates a new component with its channel set to the given channel.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onConfigUpdate(org.jgrapes.util.events.ConfigurationUpdate event)
    The component can be configured with events that include a path (see @link ConfigurationUpdate.paths()) that matches this components path (see Manager.componentPath()).
    void
    onUserAuthenticated(UserAuthenticated event, org.jgrapes.core.Channel channel)
    Sets the roles in the subject with the authenticated user.
    setReplace(boolean replace)
    Control whether the component replaces all ConsoleRoles or adds to the existing roles (default).
    Sets the roles associated with a user.

    Methods inherited from class org.jgrapes.core.Component

    channel, component, defaultCriterion, isEligibleFor, setName

    Methods inherited from class org.jgrapes.core.internal.ComponentVertex

    activeEventPipeline, addHandler, attach, channelReplacements, children, componentPath, componentVertex, detach, fire, initComponentsHandlers, iterator, name, newEventPipeline, newEventPipeline, parent, registerAsGenerator, root, toString, unregisterAsGenerator

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface org.jgrapes.core.Manager

    stream
  • Constructor Details

    • RoleConfigurator

      public RoleConfigurator(org.jgrapes.core.Channel componentChannel)
      Creates a new component with its channel set to the given channel.
      Parameters:
      componentChannel - the channel that the component’s handlers listen on by default and that Manager.fire(Event, Channel...) sends the event to
    • RoleConfigurator

      public RoleConfigurator(org.jgrapes.core.Channel componentChannel, Map<?,?> properties)
      Creates a new component with its channel set to the given channel.

      Supported properties are:

      Parameters:
      componentChannel - the channel that the component’s handlers listen on by default and that Manager.fire(Event, Channel...) sends the event to
      properties - the properties used to configure the component
  • Method Details

    • setRolesByUser

      Sets the roles associated with a user.

      The parameter is a Map<String, Set> holding the roles to be
      associated with a given user. The special key “*” may be used to specify roles that are to be added to any user.

      Parameters:
      roles - the roles
      Returns:
      the user role conlet filter
    • setReplace

      public RoleConfigurator setReplace(boolean replace)
      Control whether the component replaces all ConsoleRoles or adds to the existing roles (default).
      Parameters:
      replace - the replace
      Returns:
      the role configurator
    • onConfigUpdate

      @Handler public void onConfigUpdate(org.jgrapes.util.events.ConfigurationUpdate event)
      The component can be configured with events that include a path (see @link ConfigurationUpdate.paths()) that matches this components path (see Manager.componentPath()).

      The following properties are recognized:

      rolesByUser
      Invokes setRolesByUser(Map) with the given values.
      replace
      Invokes setReplace(boolean) with the given value.
      Parameters:
      event - the event
    • onUserAuthenticated

      @Handler(priority=900) public void onUserAuthenticated(UserAuthenticated event, org.jgrapes.core.Channel channel)
      Sets the roles in the subject with the authenticated user.
      Parameters:
      event - the event
      channel - the channel