Package ch.tocco.nice2.security.impl
Class SecurityManagerImpl
java.lang.Object
ch.tocco.nice2.security.impl.SecurityManagerImpl
- All Implemented Interfaces:
SecurityManager
-
Constructor Summary
ConstructorDescriptionSecurityManagerImpl
(org.slf4j.Logger log, PolicyCompiler policyCompiler, ContributionManager contributionManager, PrincipalManager principalManager, Authenticator authenticator, ThreadHandlerManager threadHandlerManager, TypeManager typeManager, org.springframework.context.ApplicationEventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
boolean
void
logout
(SecurityContext securityContext) Called to clean up resources when aSecurityContext
is destroyedprocessPolicy
(Object target, Policy policy, Phase phase, Predicate<Rule> filter, boolean disableProcessors) readPermission
(String domainName, String expression) void
secured()
void
setGuardFactories
(List<GuardFactory> guardFactories) void
setPolicyProcessors
(List<PolicyProcessorContribution> processors) void
setPolicyProviders
(List<PolicyProvider> providers) void
setPolicyValidators
(List<PolicyValidator> policyValidators) withAdditionalRules
(Consumer<PolicyBuilder> consumer) Note: This method sets a newSecurityContext
into theExecutionContext
.withRules
(Consumer<PolicyBuilder> consumer) Note: This method sets a newSecurityContext
into theExecutionContext
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ch.tocco.nice2.security.api.SecurityManager
login, login, processPolicy
-
Constructor Details
-
SecurityManagerImpl
public SecurityManagerImpl(org.slf4j.Logger log, @Lazy PolicyCompiler policyCompiler, @Lazy ContributionManager contributionManager, @Lazy PrincipalManager principalManager, @Lazy Authenticator authenticator, ThreadHandlerManager threadHandlerManager, TypeManager typeManager, org.springframework.context.ApplicationEventPublisher eventPublisher)
-
-
Method Details
-
setPolicyProviders
-
setPolicyValidators
-
setPolicyProcessors
-
setGuardFactories
-
initializeService
@PostConstruct public void initializeService() -
getPolicy
- Specified by:
getPolicy
in interfaceSecurityManager
-
reloadPolicy
public void reloadPolicy()- Specified by:
reloadPolicy
in interfaceSecurityManager
-
getAnonymousContext
- Specified by:
getAnonymousContext
in interfaceSecurityManager
-
anonymous
- Specified by:
anonymous
in interfaceSecurityManager
- Returns:
- Invoker that runs with an anonymous principal
- See Also:
-
withLogin
- Specified by:
withLogin
in interfaceSecurityManager
- Returns:
- Invoker that runs with the passed principal
-
withLogin
- Specified by:
withLogin
in interfaceSecurityManager
- Returns:
- Invoker that runs with the principal of the passed username and password
-
withLogin
- Specified by:
withLogin
in interfaceSecurityManager
- Parameters:
ignoreCaptchaVerification
- if true, ReCaptcha validation is skipped during login- Returns:
- Invoker that runs with the principal of the passed username and password
-
login
public SecurityContext login(Principal principal, @Nullable @Nullable UUID sessionId, boolean disablePolicyProcessors) throws SecurityException - Specified by:
login
in interfaceSecurityManager
- Throws:
SecurityException
-
logout
Description copied from interface:SecurityManager
Called to clean up resources when aSecurityContext
is destroyed- Specified by:
logout
in interfaceSecurityManager
-
processPolicy
public Policy processPolicy(Object target, Policy policy, Phase phase, Predicate<Rule> filter, boolean disableProcessors) - Specified by:
processPolicy
in interfaceSecurityManager
-
enterPrivileged
- Specified by:
enterPrivileged
in interfaceSecurityManager
- Throws:
SecurityException
-
exitPrivileged
- Specified by:
exitPrivileged
in interfaceSecurityManager
- Throws:
SecurityException
-
privileged
- Specified by:
privileged
in interfaceSecurityManager
- Returns:
- Invoker that runs in privileged mode
-
secured
- Specified by:
secured
in interfaceSecurityManager
- Returns:
- Invoker that runs in secured mode (i.e. privileged mode is not active)
-
isPrivileged
public boolean isPrivileged()- Specified by:
isPrivileged
in interfaceSecurityManager
-
readPermission
public Permission readPermission(String domainName, String expression) throws InvalidPermissionException - Specified by:
readPermission
in interfaceSecurityManager
- Throws:
InvalidPermissionException
-
getAllDomains
-
withRules
Description copied from interface:SecurityManager
Note: This method sets a newSecurityContext
into theExecutionContext
. To get the enhanced policy, it needs to be fetched again from theExecutionContext
.- Specified by:
withRules
in interfaceSecurityManager
- Returns:
- an invoker that runs with the given rules
-
withAdditionalRules
Description copied from interface:SecurityManager
Note: This method sets a newSecurityContext
into theExecutionContext
. To get the enhanced policy, it needs to be fetched again from theExecutionContext
.- Specified by:
withAdditionalRules
in interfaceSecurityManager
- Returns:
- an invoker that runs with an enhanced policy which contains the additional given rules
-