package at.gv.egovernment.moa.id.auth.builder;
import java.text.MessageFormat;
import at.gv.egovernment.moa.util.Constants;
/**
* Builder for the authentication block <saml:Assertion>
* to be included in a <CreateXMLSignatureResponse>
.
*
* @author Paul Ivancsics
* @version $Id$
*/
public class AuthenticationBlockAssertionBuilder implements Constants {
/** private static String nl contains the NewLine representation in Java*/
private static String nl = "\n";
/** private static String AUTH_BLOCK contains an XML-Auth-Block-Template */
private static String AUTH_BLOCK =
"" + nl +
" " + nl +
" " + nl +
" {2}" + nl +
" " + nl +
" " + nl +
" {3}" + nl +
" " + nl +
" " + nl +
" {4}" + nl +
" " + nl +
" " + nl +
"";
/**
* Constructor for AuthenticationBlockAssertionBuilder.
*/
public AuthenticationBlockAssertionBuilder() {
super();
}
/**
* Builds the authentication block <saml:Assertion>
.
*
* @param issuer authentication block issuer; "GivenName FamilyName"
* @param issueInstant current timestamp
* @param authURL URL of MOA-ID authentication component
* @param target "Geschäftsbereich"
* @param oaURL public URL of online application requested
* @return String representation of authentication block
* <saml:Assertion>
built
*/
public String build(String issuer, String issueInstant, String authURL, String target, String oaURL) {
String assertion = MessageFormat.format(
AUTH_BLOCK, new Object[] { issuer, issueInstant, authURL, target, oaURL });
return assertion;
}
}