Class SimpleAccessControlSftpEventListener
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter
org.apache.sshd.contrib.server.subsystem.sftp.SimpleAccessControlSftpEventListener
- All Implemented Interfaces:
EventListener, org.apache.sshd.common.util.SshdEventListener, org.apache.sshd.sftp.server.SftpEventListener
public abstract class SimpleAccessControlSftpEventListener
extends org.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter
Provides a simple access control by making a distinction between methods that provide information - including reading
data - and those that modify it
-
Field Summary
FieldsFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidblocking(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.FileHandle localHandle, long offset, long length, int mask) voidprotected abstract booleanisAccessAllowed(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Path localPath) protected booleanisAccessAllowed(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.Handle localHandle) protected abstract booleanisModificationAllowed(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Path localPath) voidlinking(org.apache.sshd.server.session.ServerSession session, Path source, Path target, boolean symLink) voidmodifyingAttributes(org.apache.sshd.server.session.ServerSession session, Path path, Map<String, ?> attrs) voidmoving(org.apache.sshd.server.session.ServerSession session, Path srcPath, Path dstPath, Collection<CopyOption> opts) voidopening(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.Handle localHandle) voidreadEntries(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.DirectoryHandle localHandle, Map<String, Path> entries) voidreading(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen) voidremoved(org.apache.sshd.server.session.ServerSession session, Path path, boolean isDirectory, Throwable thrown) voidvoidunblocking(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.FileHandle localHandle, long offset, long length) voidwriting(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen) Methods inherited from class org.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter
blocked, closed, closing, created, destroying, exiting, initialized, linked, modifiedAttributes, moved, open, openFailed, read, readingEntries, receivedExtension, unblocked, writtenMethods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.sshd.sftp.server.SftpEventListener
received
-
Field Details
-
READ_ONLY_ACCESSOR
-
-
Constructor Details
-
SimpleAccessControlSftpEventListener
protected SimpleAccessControlSftpEventListener()
-
-
Method Details
-
opening
public void opening(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.Handle localHandle) throws IOException - Specified by:
openingin interfaceorg.apache.sshd.sftp.server.SftpEventListener- Overrides:
openingin classorg.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter- Throws:
IOException
-
readEntries
public void readEntries(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.DirectoryHandle localHandle, Map<String, Path> entries) throws IOException- Specified by:
readEntriesin interfaceorg.apache.sshd.sftp.server.SftpEventListener- Overrides:
readEntriesin classorg.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter- Throws:
IOException
-
reading
public void reading(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen) throws IOException - Specified by:
readingin interfaceorg.apache.sshd.sftp.server.SftpEventListener- Overrides:
readingin classorg.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter- Throws:
IOException
-
isAccessAllowed
protected boolean isAccessAllowed(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.Handle localHandle) throws IOException - Parameters:
session- TheServerSessionthrow which the request was maderemoteHandle- The remote handle valuelocalHandle- The local handle- Returns:
trueif allowed to access the handle- Throws:
IOException- If failed to handle the call
-
isAccessAllowed
protected abstract boolean isAccessAllowed(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Path localPath) throws IOException - Parameters:
session- TheServerSessionthrow which the request was maderemoteHandle- The remote handle valuelocalPath- The localPath- Returns:
trueif allowed to access the path- Throws:
IOException- If failed to handle the call
-
writing
public void writing(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.FileHandle localHandle, long offset, byte[] data, int dataOffset, int dataLen) throws IOException - Specified by:
writingin interfaceorg.apache.sshd.sftp.server.SftpEventListener- Overrides:
writingin classorg.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter- Throws:
IOException
-
blocking
public void blocking(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.FileHandle localHandle, long offset, long length, int mask) throws IOException - Specified by:
blockingin interfaceorg.apache.sshd.sftp.server.SftpEventListener- Overrides:
blockingin classorg.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter- Throws:
IOException
-
unblocking
public void unblocking(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.FileHandle localHandle, long offset, long length) throws IOException - Specified by:
unblockingin interfaceorg.apache.sshd.sftp.server.SftpEventListener- Overrides:
unblockingin classorg.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter- Throws:
IOException
-
creating
public void creating(org.apache.sshd.server.session.ServerSession session, Path path, Map<String, ?> attrs) throws IOException- Specified by:
creatingin interfaceorg.apache.sshd.sftp.server.SftpEventListener- Overrides:
creatingin classorg.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter- Throws:
IOException
-
moving
public void moving(org.apache.sshd.server.session.ServerSession session, Path srcPath, Path dstPath, Collection<CopyOption> opts) throws IOException - Specified by:
movingin interfaceorg.apache.sshd.sftp.server.SftpEventListener- Overrides:
movingin classorg.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter- Throws:
IOException
-
removing
public void removing(org.apache.sshd.server.session.ServerSession session, Path path, boolean isDirectory) throws IOException - Specified by:
removingin interfaceorg.apache.sshd.sftp.server.SftpEventListener- Overrides:
removingin classorg.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter- Throws:
IOException
-
removed
public void removed(org.apache.sshd.server.session.ServerSession session, Path path, boolean isDirectory, Throwable thrown) throws IOException - Specified by:
removedin interfaceorg.apache.sshd.sftp.server.SftpEventListener- Overrides:
removedin classorg.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter- Throws:
IOException
-
linking
public void linking(org.apache.sshd.server.session.ServerSession session, Path source, Path target, boolean symLink) throws IOException - Specified by:
linkingin interfaceorg.apache.sshd.sftp.server.SftpEventListener- Overrides:
linkingin classorg.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter- Throws:
IOException
-
modifyingAttributes
public void modifyingAttributes(org.apache.sshd.server.session.ServerSession session, Path path, Map<String, ?> attrs) throws IOException- Specified by:
modifyingAttributesin interfaceorg.apache.sshd.sftp.server.SftpEventListener- Overrides:
modifyingAttributesin classorg.apache.sshd.sftp.server.AbstractSftpEventListenerAdapter- Throws:
IOException
-
isModificationAllowed
protected abstract boolean isModificationAllowed(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Path localPath) throws IOException - Parameters:
session- TheServerSessionthrow which the request was maderemoteHandle- The remote handle valuelocalPath- The localPath- Returns:
trueif allowed to modify the path- Throws:
IOException- If failed to handle the call
-