public abstract class

AbstractSshRequest

extends Object
implements SshScmRequest
java.lang.Object
   ↳ com.atlassian.stash.scm.ssh.AbstractSshRequest

Class Overview

Extend this class to implement support for an SSH command that skips the ScmRequestCheck pipeline. Typically any SshScmRequest implementation that does not service an SCM hosting operation (such as a pull or a push) should extend this class.

Summary

Public Constructors
AbstractSshRequest()
Public Methods
void cancel()
Override this method to perform special behaviour if the request is cancelled (e.g.
@Nullable final Repository getRepository()
This method is not applicable while isInvalid() returns true
final boolean isInvalid()
Retrieves a flag indicating whether the request is invalid.
final boolean isWrite()
This method is not applicable while isInvalid() returns true
final void sendAuthenticationError(AuthenticationState state, String message, String detailMessage)
This method is not applicable while isInvalid() returns true
final void sendError(String summary, String detailMessage)
This method is not applicable while isInvalid() returns true
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.stash.scm.ScmRequest
From interface com.atlassian.stash.scm.ssh.SshScmRequest

Public Constructors

public AbstractSshRequest ()

Public Methods

public void cancel ()

Override this method to perform special behaviour if the request is cancelled (e.g. by client disconnect).

@Nullable public final Repository getRepository ()

This method is not applicable while isInvalid() returns true

public final boolean isInvalid ()

Retrieves a flag indicating whether the request is invalid.

When ScmRequest factories are evaluating incoming requests, requests which look like they belong to the plugin in question but which use invalid or unsupported syntax may be encountered. Such requests should still be handled by the plugin, rather than being passed on. For such requests, this flag provides a mechanism for the handler to indicate that the request was understood but is invalid.

Invalid requests will not be checked, but will still be handled.

Returns
  • true, to bypass ScmRequestChecks. The SSH plugin end-point's original purpose was to facilitate hosting requests (such as a push or pull). All "valid" SSH requests are subject to permission checks and request throttling, which aren't necessarily appropriate for all SSH commands. Instead we mark the request here as invalid to skip the ScmRequestCheck pipeline. Other than skipping checks the request is processed as normal.

    If you are implementing support for an additional SCM hosting command and want to opt into ScmRequestChecks, you could consider implementing SshScmRequest directly, rather than using this abstract class.

public final boolean isWrite ()

This method is not applicable while isInvalid() returns true

public final void sendAuthenticationError (AuthenticationState state, String message, String detailMessage)

This method is not applicable while isInvalid() returns true

Throws
IOException

public final void sendError (String summary, String detailMessage)

This method is not applicable while isInvalid() returns true

Parameters
summary a brief summary of the error
detailMessage a more detailed explanation of the failure
Throws
IOException