Package org.jgrapes.webconsole.rbac
Class RoleConfigurator
java.lang.Object
org.jgrapes.core.internal.ComponentVertex
org.jgrapes.core.Component
org.jgrapes.webconsole.rbac.RoleConfigurator
- All Implemented Interfaces:
Iterable<ComponentType>
,Channel
,ComponentType
,Eligible
,Manager
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
Channel.Default
-
Field Summary
-
Constructor Summary
ConstructorDescriptionRoleConfigurator
(Channel componentChannel) Creates a new component with its channel set to the given channel.RoleConfigurator
(Channel componentChannel, Map<?, ?> properties) Creates a new component with its channel set to the given channel. -
Method Summary
Modifier and TypeMethodDescriptionvoid
The component can be configured with events that include a path (see @linkConfigurationUpdate.paths()
) that matches this components path (seeManager.componentPath()
).void
onUserAuthenticated
(UserAuthenticated event, Channel channel) Sets the roles in the subject with the authenticated user.setReplace
(boolean replace) Control whether the component replaces allConsoleRole
s or adds to the existing roles (default).setRolesByUser
(Map<String, Set<String>> roles) 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
-
Constructor Details
-
RoleConfigurator
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 thatManager.fire(Event, Channel...)
sends the event to
-
RoleConfigurator
Creates a new component with its channel set to the given channel.Supported properties are:
- rolesByUser: see
setRolesByUser(Map)
.
- Parameters:
componentChannel
- the channel that the component’s handlers listen on by default and thatManager.fire(Event, Channel...)
sends the event toproperties
- the properties used to configure the component
- rolesByUser: see
-
-
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
Control whether the component replaces allConsoleRole
s or adds to the existing roles (default).- Parameters:
replace
- the replace- Returns:
- the role configurator
-
onConfigUpdate
The component can be configured with events that include a path (see @linkConfigurationUpdate.paths()
) that matches this components path (seeManager.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
Sets the roles in the subject with the authenticated user.- Parameters:
event
- the eventchannel
- the channel
-