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

    Fields
    Modifier and Type
    Field
    Description
     

    Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean

    log
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    blocking(org.apache.sshd.server.session.ServerSession session, String remoteHandle, org.apache.sshd.sftp.server.FileHandle localHandle, long offset, long length, int mask)
     
    void
    creating(org.apache.sshd.server.session.ServerSession session, Path path, Map<String,?> attrs)
     
    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
    removing(org.apache.sshd.server.session.ServerSession session, Path path, boolean isDirectory)
     
    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

  • 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 interface org.apache.sshd.sftp.server.SftpEventListener
      Overrides:
      opening in class org.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 interface org.apache.sshd.sftp.server.SftpEventListener
      Overrides:
      readEntries in class org.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 interface org.apache.sshd.sftp.server.SftpEventListener
      Overrides:
      reading in class org.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 - The ServerSession throw which the request was made
      remoteHandle - The remote handle value
      localHandle - 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 - The ServerSession throw which the request was made
      remoteHandle - The remote handle value
      localPath - The local Path
      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 interface org.apache.sshd.sftp.server.SftpEventListener
      Overrides:
      writing in class org.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 interface org.apache.sshd.sftp.server.SftpEventListener
      Overrides:
      blocking in class org.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 interface org.apache.sshd.sftp.server.SftpEventListener
      Overrides:
      unblocking in class org.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 interface org.apache.sshd.sftp.server.SftpEventListener
      Overrides:
      creating in class org.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 interface org.apache.sshd.sftp.server.SftpEventListener
      Overrides:
      moving in class org.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 interface org.apache.sshd.sftp.server.SftpEventListener
      Overrides:
      removing in class org.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 interface org.apache.sshd.sftp.server.SftpEventListener
      Overrides:
      removed in class org.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 interface org.apache.sshd.sftp.server.SftpEventListener
      Overrides:
      linking in class org.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 interface org.apache.sshd.sftp.server.SftpEventListener
      Overrides:
      modifyingAttributes in class org.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 - The ServerSession throw which the request was made
      remoteHandle - The remote handle value
      localPath - The local Path
      Returns:
      true if allowed to modify the path
      Throws:
      IOException - If failed to handle the call