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:
java.util.EventListener,SshdEventListener,ScpTransferEventListener
public abstract class SimpleAccessControlScpEventListener extends 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
ScpTransferEventListener.FileOperation
-
-
Field Summary
Fields Modifier and Type Field Description static SimpleAccessControlScpEventListenerREAD_ONLY_ACCESSOR-
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 protectedSimpleAccessControlScpEventListener()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract booleanisFileDownloadAllowed(Session session, java.nio.file.Path path)protected abstract booleanisFileUploadAllowed(Session session, java.nio.file.Path path)voidstartFileEvent(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms)voidstartFolderEvent(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, java.util.Set<java.nio.file.attribute.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 Detail
-
READ_ONLY_ACCESSOR
public static final SimpleAccessControlScpEventListener READ_ONLY_ACCESSOR
-
-
Method Detail
-
startFileEvent
public void startFileEvent(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, long length, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms) throws java.io.IOException
- Specified by:
startFileEventin interfaceScpTransferEventListener- Overrides:
startFileEventin classAbstractScpTransferEventListenerAdapter- Parameters:
session- The client/serverSessionthrough which the transfer is being executedop- TheScpTransferEventListener.FileOperationfile- The local referenced filePathlength- Size (in bytes) of transferred dataperms- ASetofPosixFilePermissions to be applied once transfer is complete- Throws:
java.io.IOException- If failed to handle the event
-
startFolderEvent
public void startFolderEvent(Session session, ScpTransferEventListener.FileOperation op, java.nio.file.Path file, java.util.Set<java.nio.file.attribute.PosixFilePermission> perms) throws java.io.IOException
- Specified by:
startFolderEventin interfaceScpTransferEventListener- Overrides:
startFolderEventin classAbstractScpTransferEventListenerAdapter- Parameters:
session- The client/serverSessionthrough which the transfer is being executedop- TheScpTransferEventListener.FileOperationfile- The local referenced folderPathperms- ASetofPosixFilePermissions to be applied once transfer is complete- Throws:
java.io.IOException- If failed to handle the event
-
isFileDownloadAllowed
protected abstract boolean isFileDownloadAllowed(Session session, java.nio.file.Path path) throws java.io.IOException
- Parameters:
session- The client/serverSessionthrough which the transfer is being executedpath- The local file/folder path- Returns:
trueif client is allowed to read from the specified local path- Throws:
java.io.IOException- If failed to handle the call
-
isFileUploadAllowed
protected abstract boolean isFileUploadAllowed(Session session, java.nio.file.Path path) throws java.io.IOException
- Parameters:
session- The client/serverSessionthrough which the transfer is being executedpath- The local file/folder path- Returns:
trueif client is allowed to write to the specified local path- Throws:
java.io.IOException- If failed to handle the call
-
-