package at.gv.egovernment.moa.id.auth.builder; import java.text.MessageFormat; import at.gv.egovernment.moa.util.Constants; /** * Builder for the <CreateXMLSignatureRequest> structure * used for requesting a signature under the authentication block from the * security layer implementation. * * @author Paul Ivancsics * @version $Id$ */ public class CreateXMLSignatureRequestBuilder implements Constants { /** private static String nl contains the NewLine representation in Java*/ private static final String nl = "\n"; /** * XML template for the <moa:CreateXMLSignatureRequest> to be built */ private static final String CREATE_XML_SIGNATURE_REQUEST = "" + nl + "" + nl + " SecureSignatureKeypair" + nl + //TODO RS Lsg Switch SecureSignatureKeypair / CertifiedKeyPair //" CertifiedKeypair" + nl + " " + nl + " " + nl + "{1}" + " " + nl + " " + nl + " " + nl + " {0}" + nl + " " + nl + " /saml:Assertion" + nl + " " + nl + ""; /** * Constructor for CreateXMLSignatureRequestBuilder. */ public CreateXMLSignatureRequestBuilder() { super(); } /** * Builds the <CreateXMLSignatureRequest>. * * @param authBlock String representation of XML authentication block * @return String representation of <CreateXMLSignatureRequest> */ public String build(String authBlock, String[] dsigTransformInfos) { String dsigTransformInfosString = ""; for (int i = 0; i < dsigTransformInfos.length; i++) dsigTransformInfosString += dsigTransformInfos[i]; String request = MessageFormat.format( CREATE_XML_SIGNATURE_REQUEST, new Object[] { authBlock, dsigTransformInfosString }); return request; } }