The use of interfaces (such as Permission
above) makes it easy for custom policies to support any security actions. For example:[code] class Policy extends SecurityContext implements DatabaseAccess.Permission, FileAccess.Permission { public boolean isReadable(Table table) { return !table.isPrivate(); } public boolean isWritable(Table table) { return Session.getSession().getUser().isAdministrator(); } public boolean isReadable(File file) { return true; } public boolean isWritable(File file) { return false; } } ... Policy localPolicy = new Policy(); SecurityContext.enter(localPolicy); // Current thread overrides default policy (configurable) try { // (if allowed, ref. SecurityContext.isReplaceable()) ... DatabaseAccess.isReadAllowed(table); ... FileAccess.isWriteAllowed(file); ... } finally { SecurityContext.exit(); }[/code]
The default permissions managed by the {@link #DEFAULT} implementationare the permission to {@link #isReplaceable replace} the current securitycontext by default) and the permission to {@link #isConfigurable configure}the application.
@author Jean-Marie Dautelle @version 5.2, August 5, 2007The security context is stored in a {@link SecurityContextHolder}.
@author Ben Alex @version $Id: SecurityContext.java 1784 2007-02-24 21:00:24Z luke_t $The security context is stored in a {@link SecurityContextHolder}.
@author chaostone @version $Id: SecurityContext.java 2217 2007-10-27 00:45:30Z $A security context should only be associated with the execution context after authentication has occurred.
Also not that the Principal interface is not serializable but all implemenations should be.
When created a SecurityContext will be given a timeout argument which is the time in milliseconds after which the context is considered invalid. @author Daniel Bevenius @since 4.4
A security context should only be associated with the execution context after authentication has occurred.
SecurityContext
holds security information and is associated with the MuleSession.
@see org.mule.api.MuleSession
The security context is stored in a {@link SecurityContextHolder}.
@author Ben Alex
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|