Class SimpleAccessControlScpEventListener

java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.scp.common.AbstractScpTransferEventListenerAdapter
org.apache.sshd.contrib.server.scp.SimpleAccessControlScpEventListener
All Implemented Interfaces:
EventListener, org.apache.sshd.common.util.SshdEventListener, org.apache.sshd.scp.common.ScpTransferEventListener

public abstract class SimpleAccessControlScpEventListener extends org.apache.sshd.scp.common.AbstractScpTransferEventListenerAdapter
Provides a simple access control by making a distinction between methods that upload data and ones that download it
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.sshd.scp.common.ScpTransferEventListener

    org.apache.sshd.scp.common.ScpTransferEventListener.FileOperation
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     

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

    log

    Fields inherited from interface org.apache.sshd.scp.common.ScpTransferEventListener

    EMPTY
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract boolean
    isFileDownloadAllowed(org.apache.sshd.common.session.Session session, Path path)
     
    protected abstract boolean
    isFileUploadAllowed(org.apache.sshd.common.session.Session session, Path path)
     
    void
    startFileEvent(org.apache.sshd.common.session.Session session, org.apache.sshd.scp.common.ScpTransferEventListener.FileOperation op, Path file, long length, Set<PosixFilePermission> perms)
     
    void
    startFolderEvent(org.apache.sshd.common.session.Session session, org.apache.sshd.scp.common.ScpTransferEventListener.FileOperation op, Path file, Set<PosixFilePermission> perms)
     

    Methods inherited from class org.apache.sshd.scp.common.AbstractScpTransferEventListenerAdapter

    endFileEvent, endFolderEvent

    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.scp.common.ScpTransferEventListener

    handleFileEventAckInfo, handleReceiveCommandAckInfo
  • Field Details

  • Constructor Details

    • SimpleAccessControlScpEventListener

      protected SimpleAccessControlScpEventListener()
  • Method Details

    • startFileEvent

      public void startFileEvent(org.apache.sshd.common.session.Session session, org.apache.sshd.scp.common.ScpTransferEventListener.FileOperation op, Path file, long length, Set<PosixFilePermission> perms) throws IOException
      Specified by:
      startFileEvent in interface org.apache.sshd.scp.common.ScpTransferEventListener
      Overrides:
      startFileEvent in class org.apache.sshd.scp.common.AbstractScpTransferEventListenerAdapter
      Throws:
      IOException
    • startFolderEvent

      public void startFolderEvent(org.apache.sshd.common.session.Session session, org.apache.sshd.scp.common.ScpTransferEventListener.FileOperation op, Path file, Set<PosixFilePermission> perms) throws IOException
      Specified by:
      startFolderEvent in interface org.apache.sshd.scp.common.ScpTransferEventListener
      Overrides:
      startFolderEvent in class org.apache.sshd.scp.common.AbstractScpTransferEventListenerAdapter
      Throws:
      IOException
    • isFileDownloadAllowed

      protected abstract boolean isFileDownloadAllowed(org.apache.sshd.common.session.Session session, Path path) throws IOException
      Parameters:
      session - The client/server Session through which the transfer is being executed
      path - The local file/folder path
      Returns:
      true if client is allowed to read from the specified local path
      Throws:
      IOException - If failed to handle the call
    • isFileUploadAllowed

      protected abstract boolean isFileUploadAllowed(org.apache.sshd.common.session.Session session, Path path) throws IOException
      Parameters:
      session - The client/server Session through which the transfer is being executed
      path - The local file/folder path
      Returns:
      true if client is allowed to write to the specified local path
      Throws:
      IOException - If failed to handle the call