se.idsec.signservice.integration.SignRequestInput Maven / Gradle / Ivy
/*
* Copyright 2019-2022 IDsec Solutions AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package se.idsec.signservice.integration;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.Singular;
import lombok.ToString;
import se.idsec.signservice.integration.authentication.AuthnRequirements;
import se.idsec.signservice.integration.certificate.SigningCertificateRequirements;
import se.idsec.signservice.integration.config.IntegrationServiceDefaultConfiguration;
import se.idsec.signservice.integration.core.Extensible;
import se.idsec.signservice.integration.core.Extension;
import se.idsec.signservice.integration.core.ObjectBuilder;
import se.idsec.signservice.integration.document.TbsDocument;
import se.idsec.signservice.integration.signmessage.SignMessageParameters;
/**
* Class that represents the input to a {@link SignServiceIntegrationService#createSignRequest(SignRequestInput)}
* operation.
*
* @author Martin Lindström ([email protected])
* @author Stefan Santesson ([email protected])
*/
@ToString
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
public class SignRequestInput implements Extensible {
/**
* A sign requester may want to have the possibility to track an operation (via logs or by other means). Therefore,
* the use of correlation ID:s is supported by the SignService Integration Service. If a correlation ID is supplied
* this will be used in process and audit logs, and will be tied to the actual signature state ID that is generated by
* the SignService Integration Service.
*
* Note: The correlation ID is never sent to the sign service. It is only used within the SignService Integration
* Service.
*
*
* @param correlationId the correlationId to use for this process
* @return the correlation ID or null if not has been assigned
*/
@Setter
@Getter
private String correlationId;
/**
* A SignService Integration Service may be running under different policies, where a policy tells which
* {@link IntegrationServiceDefaultConfiguration} that is active.
*
* @param policy the policy identifier to use for the operation
* @return the policy identifier for this operation, or null (that denotes the default policy)
*/
@Setter
@Getter
private String policy;
/**
* The entityID of the entity that requests a signature.
*
* If not provided the SignatureService Integration Service will use the default sign requester ID
* ({@link IntegrationServiceDefaultConfiguration#getDefaultSignRequesterID()}).
*
*
* @param signRequesterID the sign requester ID
* @return the sign requester ID, or null if the default ID should be used
*/
@Setter
@Getter
private String signRequesterID;
/**
* The URL to which the user agent along with the sign response message should be directed after a signature
* operation.
*
*
* If not provided the SignatureService Integration Service will use the default return URL
* ({@link IntegrationServiceDefaultConfiguration#getDefaultReturnUrl()}).
*
*
* @param returnUrl the URL to which a sign response is to be returned
* @return the URL to which a sign response is to be returned, or null if the default URL should be used
*/
@Setter
@Getter
private String returnUrl;
/**
* The signature service URL to where SignRequest messages should be posted.
*
*
* If not provided the SignatureService Integration Service will use the default return URL
* ({@link IntegrationServiceDefaultConfiguration#getDefaultDestinationUrl()}).
*
*
* @param destinationUrl the signature service URL to where SignRequest messages should be posted
* @return the signature service URL to where SignRequest messages should be posted
*/
@Setter
@Getter
private String destinationUrl;
/**
* The algorithm identifier for the signature algorithm that should be used to sign the specified documents.
*
*
* If not provided the SignatureService Integration Service will use the default signature algorithm
* ({@link IntegrationServiceDefaultConfiguration#getDefaultSignatureAlgorithm()}).
*
*
* @param signatureAlgorithm signature algorithm identifier
* @return signature algorithm identifier
*/
@Setter
@Getter
private String signatureAlgorithm;
/**
* The requirements that the sign requester has on the principal that is to perform the signature operation.
*
* @param authnRequirements authentication requirements
* @return the authentication requirements
*/
@Setter
@Getter
private AuthnRequirements authnRequirements;
/**
* The requirements for the signature certificate that will be issued by the sign service.
*
*
* If not provided the SignatureService Integration Service will use the default requirements
* ({@link IntegrationServiceDefaultConfiguration#getDefaultCertificateRequirements()}).
*
*
* @param certificateRequirements the requirements for the signing certificate
* @return requirements for the signing certificate
*/
@Setter
@Getter
private SigningCertificateRequirements certificateRequirements;
/**
* The document(s) to be signed along with a per document signing requirements and parameters. At least one document
* must be supplied.
*
* @param tbsDocuments a list of To-be-signed documents
* @return a list of To-be-signed documents
*/
@Setter
@Getter
@Singular
private List tbsDocuments;
/**
* The sign message parameters that is used to build the sign message element that is included in the SignRequest.
*
* @param signMessageParameters the sign message parameters
* @return the sign message parameters
*/
@Setter
@Getter
private SignMessageParameters signMessageParameters;
/** Extensions for the object. */
private Extension extension;
/** {@inheritDoc} */
@Override
public Extension getExtension() {
return this.extension;
}
/** {@inheritDoc} */
@Override
public void setExtension(final Extension extension) {
this.extension = extension;
}
/**
* Builder for {@code SignRequestInput}.
*/
public static class SignRequestInputBuilder implements ObjectBuilder {
// Lombok
}
}