Package com.sun.xml.wss.core

Examples of com.sun.xml.wss.core.Timestamp


             context.timestampExported(true);

         } else {    
            
             // Processing inbound messages            
             Timestamp timestamp = null;
            
             if (context.getMode() == FilterProcessingContext.ADHOC) {
                
                 if (context.makeDynamicPolicyCallback()) {
                     TimestampPolicy policyClone = (TimestampPolicy)
                         ((TimestampPolicy)context.getSecurityPolicy()).clone();
         try {
                         DynamicApplicationContext dynamicContext =
                             new DynamicApplicationContext (context.getPolicyContext ());

                         dynamicContext.setMessageIdentifier (context.getMessageIdentifier ());
                         dynamicContext.inBoundMessage (true);
                         DynamicPolicyCallback callback =
                             new DynamicPolicyCallback (policyClone, dynamicContext);
                         ProcessingContext.copy (dynamicContext.getRuntimeProperties(), context.getExtraneousProperties());
                         HarnessUtil.makeDynamicPolicyCallback(callback,
                             context.getSecurityEnvironment().getCallbackHandler());

                     } catch (Exception e) {
                    log.log(Level.SEVERE, LogStringsMessages.WSS_1436_MESSAGE_DOESNOT_CONFORM_TIMESTAMP_POLICY(), e);
                         throw new XWSSecurityException (e);
                     }
                     context.setSecurityPolicy(policyClone);
                 }
                
                 TimestampPolicy policy = (TimestampPolicy) context.getSecurityPolicy();
                 long maxClockSkew = policy.getMaxClockSkew ();
                 long timeStampFreshness = policy.getTimestampFreshness ();

                 SecurityHeader secHeader = context.getSecurableSoapMessage().findSecurityHeader();
                 if (secHeader == null) {
             log.log(Level.SEVERE, com.sun.xml.wss.logging.LogStringsMessages.WSS_0276_INVALID_POLICY_NO_TIMESTAMP_SEC_HEADER());
                         throw new XWSSecurityException(
                        "Message does not conform to Timestamp policy: " +
                  "wsu:Timestamp element not found in header");
                 }

                 SOAPElement ts = null;

                 try {
         SOAPFactory factory = SOAPFactory.newInstance();
         Name name = factory.createName(
                         MessageConstants.TIMESTAMP_LNAME,
             MessageConstants.WSU_PREFIX,
       MessageConstants.WSU_NS);
         Iterator i = secHeader.getChildElements (name);
                    
         if (i.hasNext()) {
             ts = (SOAPElement) i.next();
       if (i.hasNext()) {
                             log.log(Level.SEVERE, com.sun.xml.wss.logging.LogStringsMessages.BSP_3227_SINGLE_TIMESTAMP());
           throw new XWSSecurityException("More than one wsu:Timestamp element in the header");
       }
         } else {
        log.log(Level.SEVERE, com.sun.xml.wss.logging.LogStringsMessages.WSS_0276_INVALID_POLICY_NO_TIMESTAMP_SEC_HEADER());
       throw new XWSSecurityException(
                             "Message does not conform to Timestamp policy: " +
                 "wsu:Timestamp element not found in header");
         }
     } catch (SOAPException se) {
       // log
       throw new XWSSecurityRuntimeException (se);
     }

     try {
         timestamp = new Timestamp (ts);                    
                 } catch (XWSSecurityException xwsse) {
                     log.log(Level.SEVERE, LogStringsMessages.WSS_1429_ERROR_TIMESTAMP_INTERNALIZATION(), xwsse);
                    throw SecurableSoapMessage.newSOAPFaultException(
                         MessageConstants.WSSE_INVALID_SECURITY,
                         "Failure in Timestamp internalization.\n" +
View Full Code Here


            secHeader.add(wsuTimestamp);
           
        } else{
             SecurityHeader secHeader = context.getSecurableSoapMessage().findOrCreateSecurityHeader();

             Timestamp wsuTimestamp = new Timestamp();
             if ("".equals(created)) {
                 wsuTimestamp.setCreated(null);
             }else {
                 wsuTimestamp.setCreated(created);
             }

             wsuTimestamp.setTimeout(timeout);
             if (id != null) {
                 wsuTimestamp.setId(id);
             }
             secHeader.insertHeaderBlock(wsuTimestamp);           
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.xml.wss.core.Timestamp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.