Click or drag to resize

SignerBaseCreateSignatureSession Method (CreateSessionRequest)

Create new session for signing customized by host application.

Namespace:  ASDSoft.WebSigner.Server
Assembly:  ASDSoft.WebSigner.Server (in ASDSoft.WebSigner.Server.dll) Version: 2.5.0
Syntax
C#
protected abstract Task<SignatureSession> CreateSignatureSession(
	CreateSessionRequest request
)

Parameters

request
Type: ASDSoft.WebSigner.Server.BrowserCreateSessionRequest
Request with identification required signing data.

Return Value

Type: TaskSignatureSession
Signature session.
Remarks
Called from service invoked by client JavaScript method AsdWebSigner.ClientFasade.startSignatureInProcess. Implementation must provide authorization for request!!!
Examples
Steps for create signing process.
C#
protected override async Task<SignatureSession> CreateSignatureSession(CreateSessionRequest request)
{
    if (request == CreateSessionRequest.Login)
        return CreateLoginSignatureSession();

    switch (request.Category.ToLower())
    {
        case "doc":
            Document[] documents = await new DocumentRepository().GetDocumentsAsync(request.Identification);
            return this.CreateSignatureSession(documents.Select(document => d.CreateSignatureRequestFromDocument(document)).ToArray());
        default:
            throw new ArgumentException($"Unknown category {request.Category}.", nameof(request.Category));
    }
}

private SignatureRequest CreateSignatureRequestFromDocument(Document document)
{
    byte[] documentHash = document.ComputeHash(HashAlgorithmName.SHA256);
    DocumentLinkContent documentLinkContent = new DocumentLinkContent(document.Id, document.Name, documentHash, SignatureType.Hash);
    return new SignatureRequest(documentLinkContent, HashAlgorithmName.SHA256);
}
See Also