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 TypeMethodDescriptionvoid
blocking
(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.FileHandle localHandle, long offset, long length, int mask) void
protected abstract boolean
isAccessAllowed
(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Path localPath) protected boolean
isAccessAllowed
(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.Handle localHandle) protected abstract boolean
isModificationAllowed
(org.apache.sshd.server.session.ServerSession session, String remoteHandle, Path localPath) void
linking
(org.apache.sshd.server.session.ServerSession session, Path source, Path target, boolean symLink) void
modifyingAttributes
(org.apache.sshd.server.session.ServerSession session, Path path, Map<String, ?> attrs) void
moving
(org.apache.sshd.server.session.ServerSession session, Path srcPath, Path dstPath, Collection<CopyOption> opts) void
opening
(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.Handle localHandle) void
readEntries
(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.DirectoryHandle localHandle, Map<String, Path> entries) 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) void
removed
(org.apache.sshd.server.session.ServerSession session, Path path, boolean isDirectory, Throwable thrown) void
void
unblocking
(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.FileHandle localHandle, long offset, long length) 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) 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, written
Methods 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, warn
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
opening
in interfaceorg.apache.sshd.sftp.server.SftpEventListener
- Overrides:
opening
in 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:
readEntries
in interfaceorg.apache.sshd.sftp.server.SftpEventListener
- Overrides:
readEntries
in 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:
reading
in interfaceorg.apache.sshd.sftp.server.SftpEventListener
- Overrides:
reading
in 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
- TheServerSession
throw which the request was maderemoteHandle
- The remote handle valuelocalHandle
- The local handle- Returns:
true
if 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
- TheServerSession
throw which the request was maderemoteHandle
- The remote handle valuelocalPath
- The localPath
- Returns:
true
if 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:
writing
in interfaceorg.apache.sshd.sftp.server.SftpEventListener
- Overrides:
writing
in 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:
blocking
in interfaceorg.apache.sshd.sftp.server.SftpEventListener
- Overrides:
blocking
in 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:
unblocking
in interfaceorg.apache.sshd.sftp.server.SftpEventListener
- Overrides:
unblocking
in 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:
creating
in interfaceorg.apache.sshd.sftp.server.SftpEventListener
- Overrides:
creating
in 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:
moving
in interfaceorg.apache.sshd.sftp.server.SftpEventListener
- Overrides:
moving
in 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:
removing
in interfaceorg.apache.sshd.sftp.server.SftpEventListener
- Overrides:
removing
in 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:
removed
in interfaceorg.apache.sshd.sftp.server.SftpEventListener
- Overrides:
removed
in 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:
linking
in interfaceorg.apache.sshd.sftp.server.SftpEventListener
- Overrides:
linking
in 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:
modifyingAttributes
in interfaceorg.apache.sshd.sftp.server.SftpEventListener
- Overrides:
modifyingAttributes
in 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
- TheServerSession
throw which the request was maderemoteHandle
- The remote handle valuelocalPath
- The localPath
- Returns:
true
if allowed to modify the path- Throws:
IOException
- If failed to handle the call
-