summaryrefslogtreecommitdiff
path: root/utils/src/main/java/at
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-12-23 16:12:09 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-12-23 16:12:09 +0000
commitb97b768ba705935caf67352a143586faa0b2371f (patch)
treee44d84e1c40ec9bda86ce8de322e88d60c9d1d35 /utils/src/main/java/at
parent5f85e3741395a4b2e8f04037372c59a27fae2665 (diff)
downloadmocca-b97b768ba705935caf67352a143586faa0b2371f.tar.gz
mocca-b97b768ba705935caf67352a143586faa0b2371f.tar.bz2
mocca-b97b768ba705935caf67352a143586faa0b2371f.zip
saml:AnyType workaround for xs:anyType (SubjectConfirmationData und AttributeValue)
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@257 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'utils/src/main/java/at')
-rw-r--r--utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java212
1 files changed, 109 insertions, 103 deletions
diff --git a/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java b/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java
index a5ceeafc..28f421a4 100644
--- a/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java
+++ b/utils/src/main/java/at/gv/egiz/idlink/IdentityLinkFactory.java
@@ -14,8 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package at.gv.egiz.idlink;
-
+package at.gv.egiz.idlink;
+
import iaik.xml.crypto.XmldsigMore;
import java.io.InputStreamReader;
@@ -88,63 +88,64 @@ import at.gv.e_government.reference.namespace.persondata._20020228_.Identificati
import at.gv.e_government.reference.namespace.persondata._20020228_.PersonNameType.FamilyName;
import at.gv.egiz.xmldsig.KeyTypeNotSupportedException;
import at.gv.egiz.xmldsig.KeyValueFactory;
-
+import oasis.names.tc.saml._1_0.assertion.AnyType;
+
public class IdentityLinkFactory {
- private static Log log = LogFactory.getLog(IdentityLinkFactory.class);
-
- /**
- * The instance returned by {@link #getInstance()}.
- */
- private static IdentityLinkFactory instance;
-
- /**
- * The <code>JAXBContext</code>.
- */
- private static JAXBContext jaxbContext;
-
- /**
- * The <code>KeyValueFactory</code>.
- */
- private static KeyValueFactory keyValueFactory;
-
- /**
- * Get an instance of this <code>CompressedIdentityLinkFactory</code>.
- *
- * @return an instance of this <code>CompressedIdentityLinkFactory</code>
- */
- public synchronized static IdentityLinkFactory getInstance() {
- if (instance == null) {
- instance = new IdentityLinkFactory();
- }
- return instance;
- }
-
- /**
- * Private constructor.
- */
- private IdentityLinkFactory() {
-
- keyValueFactory = new KeyValueFactory();
-
- StringBuffer packageNames = new StringBuffer();
- packageNames.append(at.gv.e_government.reference.namespace.persondata._20020228_.ObjectFactory.class.getPackage().getName());
- packageNames.append(":");
- packageNames.append(org.w3._2000._09.xmldsig_.ObjectFactory.class.getPackage().getName());
- packageNames.append(":");
- packageNames.append(org.w3._2001._04.xmldsig_more_.ObjectFactory.class.getPackage().getName());
- packageNames.append(":");
- packageNames.append(at.buergerkarte.namespaces.personenbindung._20020506_.ObjectFactory.class.getPackage().getName());
+ private static Log log = LogFactory.getLog(IdentityLinkFactory.class);
+
+ /**
+ * The instance returned by {@link #getInstance()}.
+ */
+ private static IdentityLinkFactory instance;
+
+ /**
+ * The <code>JAXBContext</code>.
+ */
+ private static JAXBContext jaxbContext;
+
+ /**
+ * The <code>KeyValueFactory</code>.
+ */
+ private static KeyValueFactory keyValueFactory;
+
+ /**
+ * Get an instance of this <code>CompressedIdentityLinkFactory</code>.
+ *
+ * @return an instance of this <code>CompressedIdentityLinkFactory</code>
+ */
+ public synchronized static IdentityLinkFactory getInstance() {
+ if (instance == null) {
+ instance = new IdentityLinkFactory();
+ }
+ return instance;
+ }
+
+ /**
+ * Private constructor.
+ */
+ private IdentityLinkFactory() {
+
+ keyValueFactory = new KeyValueFactory();
+
+ StringBuffer packageNames = new StringBuffer();
+ packageNames.append(at.gv.e_government.reference.namespace.persondata._20020228_.ObjectFactory.class.getPackage().getName());
+ packageNames.append(":");
+ packageNames.append(org.w3._2000._09.xmldsig_.ObjectFactory.class.getPackage().getName());
+ packageNames.append(":");
+ packageNames.append(org.w3._2001._04.xmldsig_more_.ObjectFactory.class.getPackage().getName());
+ packageNames.append(":");
+ packageNames.append(at.buergerkarte.namespaces.personenbindung._20020506_.ObjectFactory.class.getPackage().getName());
packageNames.append(":");
packageNames.append(oasis.names.tc.saml._1_0.assertion.ObjectFactory.class.getPackage().getName());
-
- try {
- jaxbContext = JAXBContext.newInstance(packageNames.toString());
- } catch (JAXBException e) {
- // we should not get an JAXBException initializing the JAXBContext
- throw new RuntimeException(e);
- }
-
+
+ try {
+ jaxbContext = JAXBContext.newInstance(packageNames.toString());
+ } catch (JAXBException e) {
+ // we should not get an JAXBException initializing the JAXBContext
+ throw new RuntimeException(e);
+ }
+
}
public JAXBElement<AssertionType> createAssertion(String assertionId,
@@ -175,11 +176,11 @@ public class IdentityLinkFactory {
return asFactory.createAssertion(assertionType);
- }
-
+ }
+
public AttributeStatementType createAttributeStatement(String idValue, String idType,
String givenName, String familyName, String dateOfBirth,
- PublicKey[] publicKeys) throws KeyTypeNotSupportedException {
+ PublicKey[] publicKeys) throws KeyTypeNotSupportedException {
oasis.names.tc.saml._1_0.assertion.ObjectFactory asFactory =
new oasis.names.tc.saml._1_0.assertion.ObjectFactory();
@@ -215,8 +216,11 @@ public class IdentityLinkFactory {
physicalPersonType.getIdentification().add(identificationType);
physicalPersonType.setName(personNameType);
physicalPersonType.setDateOfBirth(dateOfBirth);
-
- subjectConfirmationType.setSubjectConfirmationData(physicalPersonType);
+ JAXBElement<PhysicalPersonType> physicalPerson = prFactory.createPhysicalPerson(physicalPersonType);
+
+ AnyType personType = asFactory.createAnyType();
+ personType.getContent().add(physicalPerson);
+ subjectConfirmationType.setSubjectConfirmationData(personType);
JAXBElement<SubjectConfirmationType> subjectConfirmation = asFactory.createSubjectConfirmation(subjectConfirmationType);
@@ -232,52 +236,54 @@ public class IdentityLinkFactory {
AttributeType attributeType = asFactory.createAttributeType();
attributeType.setAttributeName("CitizenPublicKey");
attributeType.setAttributeNamespace("urn:publicid:gv.at:namespaces:identitylink:1.2");
- attributeType.getAttributeValue().add(createKeyValue.getValue());
+ AnyType attributeValueType = asFactory.createAnyType();
+ attributeValueType.getContent().add(createKeyValue);
+ attributeType.getAttributeValue().add(attributeValueType);
attributeStatementType.getAttribute().add(attributeType);
}
return attributeStatementType;
- }
-
- /**
- * Marshall the given <code>compressedIdentityLink</code> into a DOM document
- * with the given Nodes as <code>parent</code> and <code>nextSibling</code>
- * nodes.
- *
- * @param identityLink
- * the <code>CompressedIdentityLink</code> element
- * @param parent
- * the parent node
- * @param nextSibling
- * the next sibling node (may be <code>null</code>)
- * @param applyWorkarounds
- * apply workarounds as spefiyed by
- * {@link #applyWorkarounds(Element, int)}
- *
- * @throws JAXBException
- * if an unexpected error occurs while marshalling
- * @throws NullPointerException
- * if <code>compressdIdentityLink</code> or <code>parent</code> is
- * <code>null</code>
- */
- public void marshallIdentityLink(
- JAXBElement<AssertionType> identityLink,
- Node parent, Node nextSibling) throws JAXBException {
-
- DOMResult result = new DOMResult(parent, nextSibling);
-
- try {
- Marshaller marshaller = jaxbContext.createMarshaller();
-
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
-
- marshaller.marshal(identityLink, result);
- } catch (PropertyException e) {
- throw new RuntimeException(e);
- }
-
+ }
+
+ /**
+ * Marshall the given <code>compressedIdentityLink</code> into a DOM document
+ * with the given Nodes as <code>parent</code> and <code>nextSibling</code>
+ * nodes.
+ *
+ * @param identityLink
+ * the <code>CompressedIdentityLink</code> element
+ * @param parent
+ * the parent node
+ * @param nextSibling
+ * the next sibling node (may be <code>null</code>)
+ * @param applyWorkarounds
+ * apply workarounds as spefiyed by
+ * {@link #applyWorkarounds(Element, int)}
+ *
+ * @throws JAXBException
+ * if an unexpected error occurs while marshalling
+ * @throws NullPointerException
+ * if <code>compressdIdentityLink</code> or <code>parent</code> is
+ * <code>null</code>
+ */
+ public void marshallIdentityLink(
+ JAXBElement<AssertionType> identityLink,
+ Node parent, Node nextSibling) throws JAXBException {
+
+ DOMResult result = new DOMResult(parent, nextSibling);
+
+ try {
+ Marshaller marshaller = jaxbContext.createMarshaller();
+
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+
+ marshaller.marshal(identityLink, result);
+ } catch (PropertyException e) {
+ throw new RuntimeException(e);
+ }
+
}
public void signIdentityLink(Element assertion, X509Certificate certificate,
@@ -416,6 +422,6 @@ public class IdentityLinkFactory {
log.trace(sb.toString());
}
- }
-
-}
+ }
+
+}