org.opensaml.Configuration.getMarshallerFactory()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中org.opensaml.Configuration.getMarshallerFactory()方法的一些代码示例,展示了Configuration.getMarshallerFactory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getMarshallerFactory()方法的具体详情如下:
包路径:org.opensaml.Configuration
类名称:Configuration
方法名:getMarshallerFactory

Configuration.getMarshallerFactory介绍

暂无

代码示例

代码示例来源:origin: cloudfoundry/uaa

private void signAssertion(Assertion assertion, Credential credential)
    throws SecurityException, MarshallingException, SignatureException {
  SignatureBuilder signatureBuilder = (SignatureBuilder) builderFactory
      .getBuilder(Signature.DEFAULT_ELEMENT_NAME);
  Signature signature = signatureBuilder.buildObject();
  signature.setSigningCredential(credential);
  SecurityHelper.prepareSignatureParams(signature, credential, null, null);
  assertion.setSignature(signature);
  Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(assertion);
  marshaller.marshall(assertion);
  Signer.signObject(signature);
}

代码示例来源:origin: cloudfoundry/uaa

SecurityHelper.prepareSignatureParams(signature, defaultCredential, null, null);
assertion.setSignature(signature);
Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(assertion);
marshaller.marshall(assertion);
Signer.signObject(signature);

代码示例来源:origin: apache/cloudstack

public static String encodeSAMLRequest(XMLObject authnRequest)
    throws MarshallingException, IOException {
  Marshaller marshaller = Configuration.getMarshallerFactory()
      .getMarshaller(authnRequest);
  Element authDOM = marshaller.marshall(authnRequest);
  StringWriter requestWriter = new StringWriter();
  XMLHelper.writeNode(authDOM, requestWriter);
  String requestMessage = requestWriter.toString();
  Deflater deflater = new Deflater(Deflater.DEFLATED, true);
  ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
  DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream(byteArrayOutputStream, deflater);
  deflaterOutputStream.write(requestMessage.getBytes(Charset.forName("UTF-8")));
  deflaterOutputStream.close();
  String encodedRequestMessage = Base64.encodeBytes(byteArrayOutputStream.toByteArray(), Base64.DONT_BREAK_LINES);
  encodedRequestMessage = URLEncoder.encode(encodedRequestMessage, HttpUtils.UTF_8).trim();
  return encodedRequestMessage;
}

代码示例来源:origin: apache/cloudstack

DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.newDocument();
Marshaller out = Configuration.getMarshallerFactory().getMarshaller(spEntityDescriptor);
out.marshall(spEntityDescriptor, document);

代码示例来源:origin: be.fedict.eid-idp/eid-idp-common-saml2

/**
 * Convert specified opensaml {@link XMLObject} to specified JAXB type.
 * 
 * @param openSAMLObject
 *            the opensaml XML object.
 * @param wsType
 *            the JAXB class
 * @param <T>
 *            the JAXB type
 * @return JAXB representation of the opensaml xml object.
 */
@SuppressWarnings("unchecked")
public static <T> T toJAXB(final XMLObject openSAMLObject, Class<T> wsType) {
  try {
    Element element = Configuration.getMarshallerFactory()
        .getMarshaller(openSAMLObject).marshall(openSAMLObject);
    return ((JAXBElement<T>) JAXBContext.newInstance(wsType)
        .createUnmarshaller().unmarshal(element)).getValue();
  } catch (MarshallingException e) {
    throw new RuntimeException(
        "Marshaling from OpenSAML object failed.", e);
  } catch (JAXBException e) {
    throw new RuntimeException("Unmarshaling to JAXB object failed.", e);
  }
}

代码示例来源:origin: be.fedict.eid-idp/eid-idp-common-saml2

/**
 * Marhsall the opensaml {@link XMLObject} to a DOM {@link Element}
 * 
 * @param xmlObject
 *            the XML object
 * @return marshalled DOM element
 */
public static Element marshall(XMLObject xmlObject) {
  MarshallerFactory marshallerFactory = Configuration
      .getMarshallerFactory();
  Marshaller marshaller = marshallerFactory.getMarshaller(xmlObject);
  try {
    return marshaller.marshall(xmlObject);
  } catch (MarshallingException e) {
    throw new RuntimeException("opensaml2 marshalling error: "
        + e.getMessage(), e);
  }
}

代码示例来源:origin: OpenConext/Mujina

private String writeEntityDescriptor(EntityDescriptor entityDescriptor) throws ParserConfigurationException, MarshallingException, TransformerException {
 Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(entityDescriptor);
 Element element = marshaller.marshall(entityDescriptor);
 return XMLHelper.nodeToString(element);
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public static Element marshallObject(XMLObject object) throws Exception {
    if (object.getDOM() == null) {
      Marshaller m = (Marshaller) Configuration.getMarshallerFactory().getMarshaller(object);
      if (m == null) {
        throw new IllegalArgumentException("No unmarshaller for " + object);
      }
      try {
        return m.marshall(object);
      } catch (MarshallingException e) {
        throw new Exception(e);
      }
    } else {
      return object.getDOM();
    }
  }
}

代码示例来源:origin: edu.internet2.middleware/shibboleth-common

/**
 * Prints the given attribute statement to system output.
 * 
 * @param attributeStatement attribute statement to print
 */
private static void printAttributeStatement(SAMLObject attributeStatement) {
  if (attributeStatement == null) {
    System.out.println("No attribute statement.");
    return;
  }
  Marshaller statementMarshaller = Configuration.getMarshallerFactory().getMarshaller(attributeStatement);
  try {
    Element statement = statementMarshaller.marshall(attributeStatement);
    System.out.println(XMLHelper.prettyPrintXML(statement));
  } catch (MarshallingException e) {
    errorAndExit("Unable to marshall attribute statement", e);
  }
}

代码示例来源:origin: org.wso2.carbon.identity.agent.sso.java/org.wso2.carbon.identity.sso.agent

protected String encodeRequestMessage(SignableSAMLObject requestMessage, String binding)
    throws SSOAgentException {
  Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(requestMessage);
  Element authDOM = null;
  try {

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.sso.agent

protected String encodeRequestMessage(RequestAbstractType requestMessage, String binding)
    throws SSOAgentException {
  Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(requestMessage);
  Element authDOM = null;
  try {

代码示例来源:origin: org.adeptnet.auth/auth-saml

private String _createAuthnRequest(final String requestId) throws SAMLException {
  final AuthnRequest request = createAuthnRequest(requestId);
  
  try {
    // samlobject to xml dom object
    final Element elem = Configuration.getMarshallerFactory()
        .getMarshaller(request)
        .marshall(request);
    // and to a string...
    final Document document = elem.getOwnerDocument();
    final DOMImplementationLS domImplLS = (DOMImplementationLS) document
        .getImplementation();
    final LSSerializer serializer = domImplLS.createLSSerializer();
    serializer.getDomConfig().setParameter("xml-declaration", false);
    return serializer.writeToString(elem);
  } catch (MarshallingException e) {
    throw new SAMLException(e);
  }
}

代码示例来源:origin: org.apache.rampart/rampart-trust

Configuration.getMarshallerFactory().getMarshaller(assertion).marshall(assertion, document);
} catch (MarshallingException e) {
  log.debug("Error while marshalling assertion ", e);

代码示例来源:origin: OpenConext/Mujina

public static void signAssertion(SignableXMLObject signableXMLObject, Credential signingCredential) throws MarshallingException, SignatureException {
 Signature signature = buildSAMLObject(Signature.class, Signature.DEFAULT_ELEMENT_NAME);
 signature.setSigningCredential(signingCredential);
 signature.setSignatureAlgorithm(Configuration.getGlobalSecurityConfiguration().getSignatureAlgorithmURI(signingCredential));
 signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
 signableXMLObject.setSignature(signature);
 Configuration.getMarshallerFactory().getMarshaller(signableXMLObject).marshall(signableXMLObject);
 Signer.signObject(signature);
}

代码示例来源:origin: lastpass/saml-sdk-java

Element elem = Configuration.getMarshallerFactory()
  .getMarshaller(request)
  .marshall(request);

代码示例来源:origin: org.opensaml/opensaml

Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(signableMessage);
marshaller.marshall(signableMessage);
Signer.signObject(signature);

代码示例来源:origin: org.opensaml/opensaml

Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(signableMessage);
if (marshaller == null) {
  throw new MessageEncodingException("No marshaller registered for "

代码示例来源:origin: OpenConext/Mujina

Configuration.getMarshallerFactory().getMarshaller(entityDescriptor).marshall(entityDescriptor);
Signer.signObject(signature);

代码示例来源:origin: be.e_contract.sts/sts-client-cxf

this.securityDecorator.getPhoto());
Element element = Configuration.getMarshallerFactory()
    .getMarshaller(assertion).marshall(assertion);
return element;

相关文章