Tabnine Logo
XMLCryptoContext
Code IndexAdd Tabnine to your IDE (free)

How to use
XMLCryptoContext
in
javax.xml.crypto

Best Java code snippets using javax.xml.crypto.XMLCryptoContext (Showing top 20 results out of 315)

origin: org.apache.santuario/xmlsec

  private static boolean getBoolean(XMLCryptoContext xc, String name) {
    Boolean value = (Boolean)xc.getProperty(name);
    return value != null && value.booleanValue();
  }
}
origin: org.apache.santuario/xmlsec

/**
 * Returns the prefix associated with the specified namespace URI
 *
 * @param context contains the namespace map
 * @param nsURI the namespace URI
 * @return the prefix associated with the specified namespace URI, or
 *    null if not set
 */
public static String getNSPrefix(XMLCryptoContext context, String nsURI) {
  if (context != null) {
    return context.getNamespacePrefix
      (nsURI, context.getDefaultNamespacePrefix());
  } else {
    return null;
  }
}
origin: org.apache.santuario/xmlsec

private Data dereference(XMLCryptoContext context)
  throws XMLSignatureException
{
  Data data = null;
  // use user-specified URIDereferencer if specified; otherwise use deflt
  URIDereferencer deref = context.getURIDereferencer();
  if (deref == null) {
    deref = DOMURIDereferencer.INSTANCE;
  }
  try {
    data = deref.dereference(this, context);
    LOG.debug("URIDereferencer class name: {}", deref.getClass().getName());
    LOG.debug("Data class name: {}", data.getClass().getName());
  } catch (URIReferenceException ure) {
    throw new XMLSignatureException(ure);
  }
  return data;
}
origin: com.hynnet/xws-security

URIDereferencer resolver = context.getURIDereferencer();
URIReference uriRef = new URIReference(){
FilterProcessingContext wssContext = (FilterProcessingContext)context.get(MessageConstants.WSS_PROCESSING_CONTEXT);
origin: com.hynnet/xws-security

private Marshaller getMarshaller() throws JAXBException{
  JAXBFilterProcessingContext wssContext = (JAXBFilterProcessingContext)context.get(MessageConstants.WSS_PROCESSING_CONTEXT);
  Marshaller marshaller =  _jaxbContext.createMarshaller();
  marshaller.setProperty("com.sun.xml.bind.xmlDeclaration", false);
  if(wssContext != null)
    marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new WSSNamespacePrefixMapper(wssContext.isSOAP12()));
  else
    marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", new WSSNamespacePrefixMapper());
  marshaller.setProperty(Marshaller.JAXB_FRAGMENT,true);
  return marshaller;
}
 
origin: org.apache.santuario/xmlsec

String uri = uriRef.getURI();
DOMCryptoContext dcc = (DOMCryptoContext) context;
String baseURI = context.getBaseURI();
origin: org.apache.wss4j/wss4j-ws-security-dom

@Override
public Data transform(Data data, XMLCryptoContext context, OutputStream os) throws TransformException {
  String attachmentUri = ((ApacheOctetStreamData) data).getURI();
  String attachmentId = attachmentUri.substring(4);
  Attachment attachment;
  if (attachmentTransformParameterSpec != null) {
    attachment = attachmentTransformParameterSpec.getAttachment();
    context.setProperty(ATTACHMENT_CALLBACKHANDLER,
              attachmentTransformParameterSpec.getAttachmentCallbackHandler());
  } else {
    attachment = attachmentRequestCallback(context, attachmentId);
  }
  return processAttachment(context, os, attachmentUri, attachment);
}
origin: com.hynnet/xws-security

protected static SecurityHeaderElement resolveToken(final String uri, XMLCryptoContext context) throws
    URIReferenceException, XWSSecurityException{
  URIDereferencer resolver = context.getURIDereferencer();
  JAXBFilterProcessingContext wssContext = (JAXBFilterProcessingContext)context.get(MessageConstants.WSS_PROCESSING_CONTEXT);
origin: com.hynnet/xws-security

/** Creates a new instance of StAXEnvelopedTransformWriter */
public StAXSTRTransformWriter(XMLStreamWriter writer,Data data,XMLCryptoContext xMLCryptoContext) {
  this.nextWriter = writer;
  this.data = data;
  if(data instanceof JAXBData){
    ns = ((JAXBData)data).getNamespaceContext();
  }else if(data instanceof StreamWriterData){
    ns = ((StreamWriterData)data).getNamespaceContext();
  }
  this.xMLCryptoContext = xMLCryptoContext;
  filterContext = (JAXBFilterProcessingContext) xMLCryptoContext.get(MessageConstants.WSS_PROCESSING_CONTEXT);
}
 
origin: org.apache.santuario/xmlsec

apacheTransform =
  new Transform(ownerDoc, getAlgorithm(), transformElem.getChildNodes());
apacheTransform.setElement(transformElem, xc.getBaseURI());
boolean secVal = Utils.secureValidation(xc);
apacheTransform.setSecureValidation(secVal);
origin: org.apache.wss4j/wss4j-ws-security-dom

if (attachmentTransformParameterSpec != null) {
  attachment = attachmentTransformParameterSpec.getAttachment();
  context.setProperty(ATTACHMENT_CALLBACKHANDLER,
            attachmentTransformParameterSpec.getAttachmentCallbackHandler());
} else {
origin: org.apache.wss4j/wss4j-ws-security-dom

protected Attachment attachmentRequestCallback(XMLCryptoContext context, String attachmentId)
  throws TransformException {
  CallbackHandler attachmentCallbackHandler =
    (CallbackHandler) context.getProperty(ATTACHMENT_CALLBACKHANDLER);
  if (attachmentCallbackHandler == null) {
    throw new TransformException("No attachment callbackhandler supplied");
  }
  AttachmentRequestCallback attachmentRequestCallback = new AttachmentRequestCallback();
  attachmentRequestCallback.setAttachmentId(attachmentId);
  try {
    attachmentCallbackHandler.handle(new Callback[]{attachmentRequestCallback});
  } catch (Exception e) {
    throw new TransformException(e);
  }
  List<Attachment> attachments = attachmentRequestCallback.getAttachments();
  if (attachments == null || attachments.isEmpty() || !attachmentId.equals(attachments.get(0).getId())) {
    throw new TransformException("Attachment not found");
  }
  return attachments.get(0);
}
origin: com.hynnet/xws-security

String dsPrefix = null;
if (context != null) {
  prefix = context.getNamespacePrefix
      (WSSE, "wsse");
  dsPrefix = context.getNamespacePrefix
      (XMLSignature.XMLNS, context.getDefaultNamespacePrefix());
origin: com.hynnet/xws-security

private Data dereference(XMLCryptoContext context)
    throws XMLSignatureException {
  Data data = null;
  
  // use user-specified URIDereferencer if specified; otherwise use deflt
  URIDereferencer deref = context.getURIDereferencer();
  
  try {
    data = deref.dereference(this, context);
  } catch (URIReferenceException ure) {
    throw new XMLSignatureException(ure);
  }
  return data;
}
 
origin: com.hynnet/xws-security

public StAXSTRTransformWriter(Data data,XMLCryptoContext xMLCryptoContext,String refId) {
  this.data = data;
  if(data instanceof JAXBData){
    ns = ((JAXBData)data).getNamespaceContext();
  }else if(data instanceof StreamWriterData){
    ns = ((StreamWriterData)data).getNamespaceContext();
  }
  this.xMLCryptoContext = xMLCryptoContext;
  this.strId = refId;
  filterContext = (JAXBFilterProcessingContext) xMLCryptoContext.get(MessageConstants.WSS_PROCESSING_CONTEXT);        
}
 
origin: org.apache.santuario/xmlsec

apacheTransform =
  new Transform(ownerDoc, getAlgorithm(), transformElem.getChildNodes());
apacheTransform.setElement(transformElem, xc.getBaseURI());
boolean secVal = Utils.secureValidation(xc);
apacheTransform.setSecureValidation(secVal);
origin: org.apache.wss4j/wss4j-ws-security-dom

protected void attachmentResultCallback(XMLCryptoContext context, Attachment attachment)
  throws TransformException {
  CallbackHandler attachmentCallbackHandler =
    (CallbackHandler) context.getProperty(ATTACHMENT_CALLBACKHANDLER);
  if (attachmentCallbackHandler == null) {
    throw new TransformException("No attachment callbackhandler supplied");
  }
  AttachmentResultCallback attachmentResultCallback = new AttachmentResultCallback();
  attachmentResultCallback.setAttachmentId(attachment.getId());
  attachmentResultCallback.setAttachment(attachment);
  try {
    attachmentCallbackHandler.handle(new Callback[]{attachmentResultCallback});
  } catch (Exception e) {
    throw new TransformException(e);
  }
}
origin: com.hynnet/xws-security

protected static Node deReference(final Node node,XMLCryptoContext context)throws URIReferenceException {
  
   /*NodeList nodeList = ((Document)node).getElementsByTagNameNS(WSSE_EXT,"SecurityTokenReference");
  final Node domNode = nodeList.item(0);*/
  URIDereferencer dereferencer = context.getURIDereferencer();
  
  //Dereference SecurityTokenReference;
  DOMURIReference domReference = new DOMURIReference(){
    public Node getHere(){
      return node;
    }
    public String getURI(){
      return null;
    }
    public String getType(){
      return null;
    }
  };
  Data data = dereferencer.dereference(domReference, context);
  //Node parentNode = node.getParentNode();
  Iterator nodeIterator =  ((NodeSetData)data).iterator();
  if(nodeIterator.hasNext()){
    return (Node)nodeIterator.next();
  }else{
    throw new URIReferenceException("URI "+((Element)node).getAttribute("URI") + "not found");
  }
}
 
origin: com.hynnet/xws-security

Data dereferenceAttachments(final String uri, final XMLCryptoContext context) throws URIReferenceException{
  JAXBFilterProcessingContext filterContext = (JAXBFilterProcessingContext) context.get(MessageConstants.WSS_PROCESSING_CONTEXT);
  SecuredMessage secureMsg = filterContext.getSecuredMessage();
  Attachment attachment = secureMsg.getAttachment(uri);
  if(attachment == null){
    throw new URIReferenceException ("Attachment Resource with Identifier  "+uri+" was not found");
  }
  AttachmentData attachData = new AttachmentData(attachment);
  return attachData;
}
 
origin: org.apache.ws.security/wss4j

Object wsDocInfoObject = xc.getProperty(TRANSFORM_WS_DOC_INFO);
WSDocInfo wsDocInfo = null;
if (wsDocInfoObject instanceof WSDocInfo) {
javax.xml.cryptoXMLCryptoContext

Javadoc

Contains common context information for XML cryptographic operations.

This interface contains methods for setting and retrieving properties that affect the processing of XML signatures or XML encrypted structures.

Note that XMLCryptoContext instances can contain information and state specific to the XML cryptographic structure it is used with. The results are unpredictable if an XMLCryptoContext is used with multiple structures (for example, you should not use the same javax.xml.crypto.dsig.XMLValidateContext instance to validate two different javax.xml.crypto.dsig.XMLSignature objects).

Most used methods

  • getProperty
    Returns the value of the specified property.
  • getDefaultNamespacePrefix
    Returns the default namespace prefix. The default namespace prefix is the prefix for all namespace U
  • getNamespacePrefix
    Returns the namespace prefix that the specified namespace URI is associated with. Returns the specif
  • getURIDereferencer
    Returns a URIDereferencer that is used to dereference URIReferences.
  • get
    Returns the value to which this context maps the specified key.More formally, if this context contai
  • getBaseURI
    Returns the base URI.
  • setProperty
    Sets the specified property.

Popular in Java

  • Making http requests using okhttp
  • setScale (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now