/** * <p> * Creates a {@code WSTrustRequestWriter} that writes {@code RequestSecurityToken} instances to the specified * {@code OutputStream}. * </p> * * @param out the stream where the request is to be written. * * @throws ProcessingException if an error occurs while processing the request. */ public WSTrustRequestWriter(OutputStream out) throws ProcessingException { this.writer = StaxUtil.getXMLStreamWriter(out); }
/** * <p> * Creates a {@code WSTrustResponseWriter} instance that writes WS-Trust response messages to the specified * {@code OutputStream}. * </p> * * @param stream the where the response is to be written. * * @throws ProcessingException if an error occurs when creating the {@code XMLStreamWriter} for the specified * stream. */ public WSTrustResponseWriter(OutputStream stream) throws ProcessingException { this.writer = StaxUtil.getXMLStreamWriter(stream); }
/** * <p> * Creates a {@code WSTrustResponseWriter} instance that writes WS-Trust response messages to the specified * {@code OutputStream}. * </p> * * @param stream the where the response is to be written. * * @throws ProcessingException if an error occurs when creating the {@code XMLStreamWriter} for the specified * stream. */ public WSTrustResponseWriter(OutputStream stream) throws ProcessingException { this.writer = StaxUtil.getXMLStreamWriter(stream); }
/** * <p> * Creates a {@code WSTrustResponseWriter} instance that writes WS-Trust response messages to the specified {@code * Result}. * </p> * * @param result the {@code Result} object where the response is to be written. * * @throws ProcessingException if an error occurs when creating the {@code XMLStreamWriter} for the specified * result. */ public WSTrustResponseWriter(Result result) throws ProcessingException { this.writer = StaxUtil.getXMLStreamWriter(result); }
/** * <p> * Creates a {@code WSTrustRequestWriter} that writes {@code RequestSecurityToken} instances to the specified {@code * Result} * . * </p> * * @param result the {@code Result} where the request it to be written. * * @throws ProcessingException if an error occurs while processing the request. */ public WSTrustRequestWriter(Result result) throws ProcessingException { this.writer = StaxUtil.getXMLStreamWriter(result); }
/** * <p> * Creates a {@code WSTrustRequestWriter} that writes {@code RequestSecurityToken} instances to the specified * {@code OutputStream}. * </p> * * @param out the stream where the request is to be written. * * @throws ProcessingException if an error occurs while processing the request. */ public WSTrustRequestWriter(OutputStream out) throws ProcessingException { this.writer = StaxUtil.getXMLStreamWriter(out); }
/** * <p> * Creates a {@code WSTrustResponseWriter} instance that writes WS-Trust response messages to the specified {@code * Result}. * </p> * * @param result the {@code Result} object where the response is to be written. * * @throws ProcessingException if an error occurs when creating the {@code XMLStreamWriter} for the specified * result. */ public WSTrustResponseWriter(Result result) throws ProcessingException { this.writer = StaxUtil.getXMLStreamWriter(result); }
/** * <p> * Creates a {@code WSTrustRequestWriter} that writes {@code RequestSecurityToken} instances to the specified {@code * Result} * . * </p> * * @param result the {@code Result} where the request it to be written. * * @throws ProcessingException if an error occurs while processing the request. */ public WSTrustRequestWriter(Result result) throws ProcessingException { this.writer = StaxUtil.getXMLStreamWriter(result); }
/** * 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()); }
/** * 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()); }
/** * Marshall the response type to the output stream * * @param responseType * @param os * * @throws ProcessingException */ public void marshall(ResponseType responseType, OutputStream os) throws ProcessingException { SAMLResponseWriter samlWriter = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(os)); samlWriter.write(responseType); }
/** * Marshall the response type to the output stream * * @param responseType * @param os * * @throws ProcessingException */ public void marshall(ResponseType responseType, OutputStream os) throws ProcessingException { SAMLResponseWriter samlWriter = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(os)); samlWriter.write(responseType); }
/** * Marshall the ResponseType into a writer * * @param responseType * @param writer * * @throws ProcessingException */ public void marshall(ResponseType responseType, Writer writer) throws ProcessingException { SAMLResponseWriter samlWriter = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(writer)); samlWriter.write(responseType); } }
/** * Marshall the ResponseType into a writer * * @param responseType * @param writer * * @throws ProcessingException */ public void marshall(ResponseType responseType, Writer writer) throws ProcessingException { SAMLResponseWriter samlWriter = new SAMLResponseWriter(StaxUtil.getXMLStreamWriter(writer)); samlWriter.write(responseType); } }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType(JBossSAMLConstants.METADATA_MIME.get()); OutputStream os = resp.getOutputStream(); try { XMLStreamWriter streamWriter = StaxUtil.getXMLStreamWriter(os); SAMLMetadataWriter writer = new SAMLMetadataWriter(streamWriter); writer.writeEntityDescriptor(metadata); } catch (ProcessingException e) { throw new ServletException(e); } /* * JAXBElement<?> jaxbEl = MetaDataBuilder.getObjectFactory().createEntityDescriptor(metadata); try { * MetaDataBuilder.getMarshaller().marshal(jaxbEl , os); } catch (Exception e) { throw new RuntimeException(e); } */ }
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType(JBossSAMLConstants.METADATA_MIME.get()); OutputStream os = resp.getOutputStream(); try { XMLStreamWriter streamWriter = StaxUtil.getXMLStreamWriter(os); SAMLMetadataWriter writer = new SAMLMetadataWriter(streamWriter); writer.writeEntityDescriptor(metadata); } catch (ProcessingException e) { throw new ServletException(e); } /* * JAXBElement<?> jaxbEl = MetaDataBuilder.getObjectFactory().createEntityDescriptor(metadata); try { * MetaDataBuilder.getMarshaller().marshal(jaxbEl , os); } catch (Exception e) { throw new RuntimeException(e); } */ }
/** * Marshall the AuthnRequestType to an output stream * * @param requestType * @param os * * @throws SAXException */ public void marshall(RequestAbstractType requestType, OutputStream os) throws ProcessingException { SAMLRequestWriter samlRequestWriter = new SAMLRequestWriter(StaxUtil.getXMLStreamWriter(os)); if (requestType instanceof AuthnRequestType) { samlRequestWriter.write((AuthnRequestType) requestType); } else if (requestType instanceof LogoutRequestType) { samlRequestWriter.write((LogoutRequestType) requestType); } else throw logger.unsupportedType(requestType.getClass().getName()); }
/** * Marshall the AuthnRequestType to an output stream * * @param requestType * @param os * * @throws SAXException */ public void marshall(RequestAbstractType requestType, OutputStream os) throws ProcessingException { SAMLRequestWriter samlRequestWriter = new SAMLRequestWriter(StaxUtil.getXMLStreamWriter(os)); if (requestType instanceof AuthnRequestType) { samlRequestWriter.write((AuthnRequestType) requestType); } else if (requestType instanceof LogoutRequestType) { samlRequestWriter.write((LogoutRequestType) requestType); } else throw logger.unsupportedType(requestType.getClass().getName()); }
/** * Marshall the AuthnRequestType to a writer * * @param requestType * @param writer * * @throws SAXException */ public void marshall(RequestAbstractType requestType, Writer writer) throws ProcessingException { SAMLRequestWriter samlRequestWriter = new SAMLRequestWriter(StaxUtil.getXMLStreamWriter(writer)); if (requestType instanceof AuthnRequestType) { samlRequestWriter.write((AuthnRequestType) requestType); } else if (requestType instanceof LogoutRequestType) { samlRequestWriter.write((LogoutRequestType) requestType); } else throw logger.unsupportedType(requestType.getClass().getName()); } }
public Source invoke(Source request) { try { Document doc = (Document) DocumentUtil.getNodeFromSource(request); if (logger.isTraceEnabled()) { logger.trace("XACML Received Message: " + DocumentUtil.asString(doc)); } XACMLAuthzDecisionQueryType xacmlQuery = SOAPSAMLXACMLUtil.getXACMLQueryType(doc); ResponseType samlResponseType = SOAPSAMLXACMLUtil.handleXACMLQuery(pdp, issuer, xacmlQuery); ByteArrayOutputStream baos = new ByteArrayOutputStream(); XMLStreamWriter xmlStreamWriter = StaxUtil.getXMLStreamWriter(baos); SAMLResponseWriter samlResponseWriter = new SAMLResponseWriter(xmlStreamWriter); samlResponseWriter.write(samlResponseType); Document responseDocument = DocumentUtil.getDocument(new ByteArrayInputStream(baos.toByteArray())); return new DOMSource(responseDocument.getDocumentElement()); } catch (Exception e) { throw logger.xacmlPDPMessageProcessingError(e); } }