Class AMNetScpFileOpener
Default .NET-facing SCP filesystem policy hook. Override this class to implement application-specific SCP path, stream, and permission behavior without using Apache MINA or Java types in application code.
Implements
Inherited Members
Namespace: ApacheMinaSSHD.NET.Wrapper.Abstractions
Assembly: ApacheMinaSSHD.NET.Wrapper.dll
Syntax
public class AMNetScpFileOpener : IAMNetScpFileOpener
Constructors
| Edit this page View SourceAMNetScpFileOpener(string?)
Creates a default SCP policy hook.
Declaration
public AMNetScpFileOpener(string? rootPath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | rootPath | Optional root path used by the default path allow-list behavior. |
Properties
| Edit this page View SourceHiddenNames
File or directory names (case-insensitive) that should be hidden by the default policy.
Declaration
protected virtual IReadOnlySet<string> HiddenNames { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlySet<string> |
RootPath
Gets the optional local root path used by the default path allow-list behavior.
Declaration
public string? RootPath { get; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
| Edit this page View SourceCloseRead(ISshScpFileAccess)
Called after a local file read/send handle is closed.
Declaration
public virtual void CloseRead(ISshScpFileAccess access)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
CloseWrite(ISshScpFileAccess)
Called after a local file write/receive handle is closed.
Declaration
public virtual void CloseWrite(ISshScpFileAccess access)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
CreateSourceStreamResolver(ISshScpFileAccess)
Called when the server creates an outgoing SCP source stream resolver.
Declaration
public virtual void CreateSourceStreamResolver(ISshScpFileAccess access)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
CreateTargetStreamResolver(ISshScpFileAccess)
Called when the server creates an incoming SCP target stream resolver.
Declaration
public virtual void CreateTargetStreamResolver(ISshScpFileAccess access)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
GetLocalFilePermissions(ISshScpFileAccess, IReadOnlyList<string>)
Allows the application to filter or rewrite local file permissions reported to SCP clients.
Declaration
public virtual IReadOnlyList<string> GetLocalFilePermissions(ISshScpFileAccess access, IReadOnlyList<string> permissions)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
| IReadOnlyList<string> | permissions | The default permission names. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<string> | The permission names to use. |
GetMatchingFilesToSend(ISshScpFileAccess, IReadOnlyList<string>)
Filters or rewrites files that match an outgoing SCP pattern.
Declaration
public virtual IReadOnlyList<string> GetMatchingFilesToSend(ISshScpFileAccess access, IReadOnlyList<string> resolvedPaths)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
| IReadOnlyList<string> | resolvedPaths | The default matching local paths. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<string> | The local paths that may be sent. |
IsPathAllowed(ISshScpFileAccess)
Returns whether the requested SCP path or operation is allowed.
Declaration
public virtual bool IsPathAllowed(ISshScpFileAccess access)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
Returns
| Type | Description |
|---|---|
| bool |
|
OpenRead(ISshScpFileAccess)
Called before a local file is opened for SCP read/send.
Declaration
public virtual void OpenRead(ISshScpFileAccess access)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
OpenWrite(ISshScpFileAccess)
Called before a local file is opened for SCP write/receive.
Declaration
public virtual void OpenWrite(ISshScpFileAccess access)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
ReadLocalBasicFileAttributes(ISshScpFileAccess, IReadOnlyDictionary<string, object>)
Allows the application to filter or rewrite file attributes reported to SCP clients.
Declaration
public virtual IReadOnlyDictionary<string, object> ReadLocalBasicFileAttributes(ISshScpFileAccess access, IReadOnlyDictionary<string, object> attributes)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
| IReadOnlyDictionary<string, object> | attributes | The default attributes. |
Returns
| Type | Description |
|---|---|
| IReadOnlyDictionary<string, object> | The attributes to use. |
ResolveIncomingFilePath(ISshScpFileAccess, string)
Allows the application to rewrite the destination path for an incoming file.
Declaration
public virtual string ResolveIncomingFilePath(ISshScpFileAccess access, string resolvedPath)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
| string | resolvedPath | The default resolved path. |
Returns
| Type | Description |
|---|---|
| string | The local path to use for the incoming file. |
ResolveIncomingReceiveLocation(ISshScpFileAccess, string)
Allows the application to rewrite the receive location for incoming SCP data.
Declaration
public virtual string ResolveIncomingReceiveLocation(ISshScpFileAccess access, string resolvedPath)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
| string | resolvedPath | The default resolved path. |
Returns
| Type | Description |
|---|---|
| string | The local receive location to use. |
ResolveLocalPath(ISshScpFileAccess, string)
Allows the application to rewrite a client path into a local path.
Declaration
public virtual string ResolveLocalPath(ISshScpFileAccess access, string resolvedPath)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
| string | resolvedPath | The default resolved path. |
Returns
| Type | Description |
|---|---|
| string | The local path to use. |
ResolveOutgoingFilePath(ISshScpFileAccess, string)
Allows the application to rewrite the source path for an outgoing file.
Declaration
public virtual string ResolveOutgoingFilePath(ISshScpFileAccess access, string resolvedPath)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
| string | resolvedPath | The default resolved path. |
Returns
| Type | Description |
|---|---|
| string | The local path to send. |
ShouldIncludeDirectoryEntry(ISshScpFileAccess)
Returns whether a directory entry should be visible during recursive SCP.
Declaration
public virtual bool ShouldIncludeDirectoryEntry(ISshScpFileAccess access)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
Returns
| Type | Description |
|---|---|
| bool |
|
ShouldSendAsDirectory(ISshScpFileAccess, bool)
Returns whether the path should be sent as a directory.
Declaration
public virtual bool ShouldSendAsDirectory(ISshScpFileAccess access, bool defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
| bool | defaultValue | The default server decision. |
Returns
| Type | Description |
|---|---|
| bool | The decision to use. |
ShouldSendAsRegularFile(ISshScpFileAccess, bool)
Returns whether the path should be sent as a regular file.
Declaration
public virtual bool ShouldSendAsRegularFile(ISshScpFileAccess access, bool defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| ISshScpFileAccess | access | Operation metadata for the SCP request. |
| bool | defaultValue | The default server decision. |
Returns
| Type | Description |
|---|---|
| bool | The decision to use. |