public interface SignatureService
Signatures represent a "stamp" for a particular user for a particular version of a file. For example, the signature can represent an approval (or disapproval) of a particular version of a file by a specific user. The signature can enable administrative users to track the viability of a version of a file through a loosely-defined approval process. The signature can be used to track an overall sign-off process that enables users to promote (or demote) specific files in a production environment. This is one example of how signatures can be used.
Repository files can be either versioned or not when they are signed. Containers cannot be signed.
When an unversioned file is updated or deleted, all of the signatures are removed. Because signatures are tied to a particular version of a file, the signatures are linked to that content's lifecycle. When a new version of a versioned file is created, the signatures associated with the prior version are kept and are accessible because the prior version is maintained within the repository. If a versioned file is deleted, all of the signatures are removed from the system.
Modifier and Type | Method and Description |
---|---|
Signature |
createSignature(String path,
CreateSignatureInfo createSignatureInfo)
Creates a signature for the current version of a file (only the current version of a file can be
signed).
|
Set<String> |
getSignatureReasons()
Gets all of the valid signature reasons that can be used to populate a
CreateSignatureInfo object
to create a signature for a repository file. |
Set<String> |
getSignatureRoles()
Gets all of the valid signature roles that can be used to populate a
CreateSignatureInfo object
to create a signature for a repository file. |
Set<Signature> |
getSignatures(String path)
Gets all of the signatures associated with a file.
|
Set<Signature> |
getSignaturesByVersion(String path,
String version)
Gets the signatures for a specific version of a file.
|
Set<Signature> |
getSignaturesForLatestVersion(String path)
Gets the signatures for the latest version of a file.
|
RepositoryFile.SigningStatus |
getSigningStatus(String path)
Describes the overall signature status of the file.
|
boolean |
isVersionSigned(String path,
String version)
Indicates whether a signatures exists for the specific version of a file.
|
Set<String> getSignatureReasons()
CreateSignatureInfo
object
to create a signature for a repository file. The Set
of reasons is pre-configured on the
server and is used to validate any signature that is created.set
of valid signature reasons.createSignature(String, CreateSignatureInfo)
Set<String> getSignatureRoles()
CreateSignatureInfo
object
to create a signature for a repository file. The Set
of roles is pre-configured on the
server and is used to validate any signature being created.set
of valid signature roles.createSignature(String, CreateSignatureInfo)
Signature createSignature(String path, CreateSignatureInfo createSignatureInfo) throws AuthenticationException, SigningException
CreateSignatureInfo
object must contain the valid credentials of the user who
signs the file. The credentials are used to verify the authenticity of the signer, so issues
that arise when authenticating the signer generate an AuthenticationException
.
The signing parameters supplied in the CreateSignatureInfo
object are stored with the
signature and be used to generate the signature value itself. The signature metadata not only describes the
signature itself, it is used in the cryptography to generate the signature value. Therefore, the signature is
self-describing and self-validating.
The signature role that is specified on the CreateSignatureInfo
object is required and must be a valid signing
role that matches a value from getSignatureRoles()
. The signature reason that is specified on the
CreateSignatureInfo
object is required and must be a valid signing reason that matches a value from
getSignatureReasons()
. The signature comment is optional.
path
- The path to the file to sign.createSignatureInfo
- The parameters to be used to create the signature, including the credentials of the
signer.Signature
object to be created.AuthenticationException
- Thrown when the credentials presented are incorrect or the account being used is
locked, expired, or inactive.SigningException
- Thrown when the signature generation process fails.getSignatureRoles()
,
getSignatureReasons()
RepositoryFile.SigningStatus getSigningStatus(String path) throws RepositoryItemNotFoundException
NONE
, CURRENT
, PREVIOUS
, and CURRENT_AND_PREVIOUS
. CURRENT
means the
current version is signed and no previous version is signed. PREVIOUS
means at least one previous version
of the file is signed and the current version is not signed. CURRENT_AND_PREVIOUS
means the current
version is signed and at least one previous version is signed.
If the file is not versioned, the possible values are NONE
and CURRENT
.
path
- The path to the file.RepositoryItemNotFoundException
- Thrown when the file does not exist.boolean isVersionSigned(String path, String version)
False
will be returned. The
version must be a valid repository file version label, such as one returned by calling
RepositoryFile.getVersion()
.path
- The path to the file.version
- The version of the file.True
, if signatures exist for the version of the file, False
otherwise.RepositoryFile.getVersion()
Set<Signature> getSignatures(String path) throws RepositoryItemNotFoundException
IllegalArgumentException
is thrown because container objects cannot be signed.
If the path does not exist, a RepositoryItemNotFoundException
is thrown.
path
- The path to the file.set
of signatures that correspond to all versions of the file.RepositoryItemNotFoundException
- Thrown when the file does not exist.Set<Signature> getSignaturesForLatestVersion(String path) throws RepositoryItemNotFoundException
IllegalArgumentException
is thrown because container objects cannot be
signed.
If the path does not exist, a RepositoryItemNotFoundException
is thrown.
path
- The path to the file.set
of signatures that were created for the current version of the file.RepositoryItemNotFoundException
- Thrown when the file does not exist.Set<Signature> getSignaturesByVersion(String path, String version) throws RepositoryItemNotFoundException
IllegalArgumentException
is thrown because container objects
cannot be signed. The version must be a valid repository file
version label, such as RepositoryFile.getVersion()
.
If the path does not exist, or the version does not exist then a RepositoryItemNotFoundException
is
thrown.
path
- The path to the file.version
- The version of the file.set
of signatures that were created for this version of the file.RepositoryItemNotFoundException
- Thrown when the file or version does not exist.RepositoryFile.getVersion()
Copyright (c) 2020, SAS Institute Inc., Cary, NC, USA