/** * Given {@code AssertionType}, convert it into a String * @param assertion * @return * @throws ProcessingException */ public static String asString(AssertionType assertion) throws ProcessingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SAMLAssertionWriter writer = new SAMLAssertionWriter(StaxUtil.getXMLStreamWriter(baos)); writer.write(assertion); return new String(baos.toByteArray()); }
public void write(AttributeStatementType statement) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.ATTRIBUTE_STATEMENT.get(), ASSERTION_NSURI.get()); List<ASTChoiceType> attributes = statement.getAttributes(); if (attributes != null) { for (ASTChoiceType attr : attributes) { AttributeType attributeType = attr.getAttribute(); if (attributeType != null) { write(attributeType); } EncryptedElementType encType = attr.getEncryptedAssertion(); if (encType != null) throw new RuntimeException(ErrorCodes.NOT_IMPLEMENTED_YET); } } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
public SAMLResponseWriter(XMLStreamWriter writer) { super(writer); this.assertionWriter = new SAMLAssertionWriter(writer); }
public void write(AttributeStatementType statement) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.ATTRIBUTE_STATEMENT.get(), ASSERTION_NSURI.get()); List<ASTChoiceType> attributes = statement.getAttributes(); if (attributes != null) { for (ASTChoiceType attr : attributes) { AttributeType attributeType = attr.getAttribute(); if (attributeType != null) { write(attributeType); } EncryptedElementType encType = attr.getEncryptedAssertion(); if (encType != null) throw new RuntimeException(ErrorCodes.NOT_IMPLEMENTED_YET); } } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
public SAMLResponseWriter(XMLStreamWriter writer) { super(writer); this.assertionWriter = new SAMLAssertionWriter(writer); }
/** * Given {@code AssertionType}, convert it into a String * * @param assertion * @return * @throws ProcessingException */ public static String asString(AssertionType assertion) throws ProcessingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SAMLAssertionWriter writer = new SAMLAssertionWriter(StaxUtil.getXMLStreamWriter(baos)); writer.write(assertion); return new String(baos.toByteArray()); }
public void write(AttributeStatementType statement) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.ATTRIBUTE_STATEMENT.get(), ASSERTION_NSURI.get()); List<ASTChoiceType> attributes = statement.getAttributes(); if (attributes != null) { for (ASTChoiceType attr : attributes) { AttributeType attributeType = attr.getAttribute(); if (attributeType != null) { write(attributeType); } EncryptedElementType encType = attr.getEncryptedAssertion(); if (encType != null) throw logger.notImplementedYet("EncryptedElementType"); } } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
public SAMLResponseWriter(XMLStreamWriter writer) { super(writer); this.assertionWriter = new SAMLAssertionWriter(writer); }
/** * Given {@code AssertionType}, convert it into a String * @param assertion * @return * @throws ProcessingException */ public static String asString(AssertionType assertion) throws ProcessingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SAMLAssertionWriter writer = new SAMLAssertionWriter(StaxUtil.getXMLStreamWriter(baos)); writer.write(assertion); return new String(baos.toByteArray()); }
public void write(AttributeStatementType statement) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.ATTRIBUTE_STATEMENT.get(), ASSERTION_NSURI.get()); List<ASTChoiceType> attributes = statement.getAttributes(); if (attributes != null) { for (ASTChoiceType attr : attributes) { AttributeType attributeType = attr.getAttribute(); if (attributeType != null) { write(attributeType); } EncryptedElementType encType = attr.getEncryptedAssertion(); if (encType != null) throw logger.notImplementedYet("EncryptedElementType"); } } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
public SAMLResponseWriter(XMLStreamWriter writer) { super(writer); this.assertionWriter = new SAMLAssertionWriter(writer); }
/** * Given {@code AssertionType}, convert it into a String * * @param assertion * * @return * * @throws ProcessingException */ public static String asString(AssertionType assertion) throws ProcessingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SAMLAssertionWriter writer = new SAMLAssertionWriter(StaxUtil.getXMLStreamWriter(baos)); writer.write(assertion); return new String(baos.toByteArray()); }
public void write(AttributeStatementType statement) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.ATTRIBUTE_STATEMENT.get(), ASSERTION_NSURI.get()); List<ASTChoiceType> attributes = statement.getAttributes(); if (attributes != null) { for (ASTChoiceType attr : attributes) { AttributeType attributeType = attr.getAttribute(); if (attributeType != null) { write(attributeType); } EncryptedElementType encType = attr.getEncryptedAssertion(); if (encType != null) throw logger.notImplementedYet("EncryptedElementType"); } } StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
public SAMLResponseWriter(XMLStreamWriter writer) { super(writer); this.assertionWriter = new SAMLAssertionWriter(writer); }
/** * Given {@code AssertionType}, convert it into a String * * @param assertion * * @return * * @throws ProcessingException */ public static String asString(AssertionType assertion) throws ProcessingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SAMLAssertionWriter writer = new SAMLAssertionWriter(StaxUtil.getXMLStreamWriter(baos)); writer.write(assertion); return new String(baos.toByteArray()); }
/** * Write an {@code AuthnStatementType} to stream * * @param authnStatement * @param out * @throws ProcessingException */ public void write(AuthnStatementType authnStatement) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.AUTHN_STATEMENT.get(), ASSERTION_NSURI.get()); XMLGregorianCalendar authnInstant = authnStatement.getAuthnInstant(); if (authnInstant != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.AUTHN_INSTANT.get(), authnInstant.toString()); } AuthnContextType authnContext = authnStatement.getAuthnContext(); if (authnContext != null) write(authnContext); StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
/** * Given {@code AssertionType}, convert it into a DOM Document. * * @param assertion * @return * @throws ProcessingException */ public static Document asDocument(AssertionType assertion) throws ProcessingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SAMLAssertionWriter writer = new SAMLAssertionWriter(StaxUtil.getXMLStreamWriter(baos)); writer.write(assertion); try { return DocumentUtil.getDocument(new ByteArrayInputStream(baos.toByteArray())); } catch (Exception e) { throw logger.processingError(e); } }
/** * Write an {@code AuthnStatementType} to stream * * @param authnStatement * @param out * @throws ProcessingException */ public void write(AuthnStatementType authnStatement) throws ProcessingException { StaxUtil.writeStartElement(writer, ASSERTION_PREFIX, JBossSAMLConstants.AUTHN_STATEMENT.get(), ASSERTION_NSURI.get()); XMLGregorianCalendar authnInstant = authnStatement.getAuthnInstant(); if (authnInstant != null) { StaxUtil.writeAttribute(writer, JBossSAMLConstants.AUTHN_INSTANT.get(), authnInstant.toString()); } AuthnContextType authnContext = authnStatement.getAuthnContext(); if (authnContext != null) write(authnContext); StaxUtil.writeEndElement(writer); StaxUtil.flush(writer); }
/** * Given {@code AssertionType}, convert it into a DOM Document. * * @param assertion * * @return * * @throws ProcessingException */ public static Document asDocument(AssertionType assertion) throws ProcessingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); SAMLAssertionWriter writer = new SAMLAssertionWriter(StaxUtil.getXMLStreamWriter(baos)); writer.write(assertion); try { return DocumentUtil.getDocument(new ByteArrayInputStream(baos.toByteArray())); } catch (Exception e) { throw logger.processingError(e); } }