136136 * @author Arjen Poutsma 
137137 * @author Greg Turnquist 
138138 * @author Jamin Hitchcock 
139+  * @author Rob Leland 
139140 * @see <a href="http://ws.apache.org/wss4j/">Apache WSS4J 2.0</a> 
140141 * @since 2.3.0 
141142 */ 
@@ -406,6 +407,7 @@ public void setSecurementUsername(String securementUsername) {
406407
407408	/** Sets the time to live on the outgoing message */ 
408409	public  void  setSecurementTimeToLive (int  securementTimeToLive ) {
410+ 
409411		if  (securementTimeToLive  <= 0 ) {
410412			throw  new  IllegalArgumentException ("timeToLive must be positive" );
411413		}
@@ -430,6 +432,7 @@ public void setSecurementSamlCallbackHandler(CallbackHandler samlCallbackHandler
430432
431433	/** Sets the server-side time to live */ 
432434	public  void  setValidationTimeToLive (int  validationTimeToLive ) {
435+ 
433436		if  (validationTimeToLive  <= 0 ) {
434437			throw  new  IllegalArgumentException ("timeToLive must be positive" );
435438		}
@@ -438,6 +441,7 @@ public void setValidationTimeToLive(int validationTimeToLive) {
438441
439442	/** Sets the validation actions to be executed by the interceptor. */ 
440443	public  void  setValidationActions (String  actions ) {
444+ 
441445		this .validationActions  = actions ;
442446		try  {
443447			validationActionsVector  = WSSecurityUtil .decodeAction (actions );
@@ -451,7 +455,7 @@ public void setValidationActor(String validationActor) {
451455	}
452456
453457	/** 
454- 	 * Sets the {@link org.apache.ws.security.WSPasswordCallback} handler  to use when validating messages. 
458+ 	 * Sets the {@link CallbackHandler}  to use when validating messages. 
455459	 * 
456460	 * @see #setValidationCallbackHandlers(CallbackHandler[]) 
457461	 */ 
@@ -460,7 +464,7 @@ public void setValidationCallbackHandler(CallbackHandler callbackHandler) {
460464	}
461465
462466	/** 
463- 	 * Sets the {@link org.apache.ws.security.WSPasswordCallback} handlers  to use when validating messages. 
467+ 	 * Sets the {@link CallbackHandler}s  to use when validating messages. 
464468	 * 
465469	 * @see #setValidationCallbackHandler(CallbackHandler) 
466470	 */ 
@@ -480,6 +484,7 @@ public void setValidationSignatureCrypto(Crypto signatureCrypto) {
480484
481485	/** Whether to enable signatureConfirmation or not. By default signatureConfirmation is enabled */ 
482486	public  void  setEnableSignatureConfirmation (boolean  enableSignatureConfirmation ) {
487+ 
483488		handler .setOption (WSHandlerConstants .ENABLE_SIGNATURE_CONFIRMATION , enableSignatureConfirmation );
484489		this .enableSignatureConfirmation  = enableSignatureConfirmation ;
485490	}
@@ -523,6 +528,7 @@ public void setSecurementUsernameTokenCreated(boolean securementUsernameTokenCre
523528	 * @param config web service security configuration or {@code null} to use default settings 
524529	 */ 
525530	public  void  setWssConfig (WSSConfig  config ) {
531+ 
526532		securityEngine .setWssConfig (config );
527533		wssConfig  = config ;
528534	}
@@ -538,15 +544,17 @@ public void setEnableRevocation(boolean enableRevocation) {
538544	 * Set the WS-I Basic Security Profile compliance mode. Default is {@code true}. 
539545	 */ 
540546	public  void  setBspCompliant (boolean  bspCompliant ) {
547+ 
541548		this .handler .setOption (WSHandlerConstants .IS_BSP_COMPLIANT , bspCompliant );
542549		this .bspCompliant  = bspCompliant ;
543550	}
544551
545552	/** 
546- 	 * Sets whether to add an InclusiveNamespaces PrefixList as a CanonicalizationMethod child 
547- 	 * when generating Signatures  using WSConstants.C14N_EXCL_OMIT_COMMENTS. Default is {@code true}. 
553+ 	 * Sets whether to add an InclusiveNamespaces PrefixList as a CanonicalizationMethod child when generating Signatures  
554+ 	 * using WSConstants.C14N_EXCL_OMIT_COMMENTS. Default is {@code true}. 
548555	 */ 
549556	public  void  setAddInclusivePrefixes (boolean  addInclusivePrefixes ) {
557+ 
550558		this .handler .setOption (WSHandlerConstants .ADD_INCLUSIVE_PREFIXES , addInclusivePrefixes );
551559		this .addInclusivePrefixes  = addInclusivePrefixes ;
552560	}
@@ -563,6 +571,7 @@ public void setAllowRSA15KeyTransportAlgorithm(boolean allow) {
563571	 * is 60 seconds. 
564572	 */ 
565573	public  void  setFutureTimeToLive (int  futureTimeToLive ) {
574+ 
566575		if  (futureTimeToLive  <= 0 ) {
567576			throw  new  IllegalArgumentException ("futureTimeToLive must be positive" );
568577		}
@@ -579,6 +588,7 @@ public void setRemoveSecurityHeader(boolean removeSecurityHeader) {
579588
580589	@ Override 
581590	public  void  afterPropertiesSet () throws  Exception  {
591+ 
582592		Assert .isTrue (validationActions  != null  || securementActions  != null ,
583593				"validationActions or securementActions are required" );
584594		if  (validationActions  != null ) {
@@ -592,7 +602,6 @@ public void afterPropertiesSet() throws Exception {
592602		}
593603		// securement actions are not to be validated at start up as they could 
594604		// be configured dynamically via the message context 
595- 
596605	}
597606
598607	@ Override 
@@ -631,6 +640,7 @@ protected void secureMessage(SoapMessage soapMessage, MessageContext messageCont
631640	 * @return the request data 
632641	 */ 
633642	protected  RequestData  initializeRequestData (MessageContext  messageContext ) {
643+ 
634644		RequestData  requestData  = new  RequestData ();
635645		requestData .setMsgContext (messageContext );
636646
@@ -667,6 +677,7 @@ protected RequestData initializeRequestData(MessageContext messageContext) {
667677	 * @return the request data 
668678	 */ 
669679	protected  RequestData  initializeValidationRequestData (MessageContext  messageContext ) {
680+ 
670681		RequestData  requestData  = new  RequestData ();
671682		requestData .setMsgContext (messageContext );
672683
@@ -696,6 +707,7 @@ protected RequestData initializeValidationRequestData(MessageContext messageCont
696707	@ Override 
697708	protected  void  validateMessage (SoapMessage  soapMessage , MessageContext  messageContext )
698709			throws  WsSecurityValidationException  {
710+ 
699711		if  (logger .isDebugEnabled ()) {
700712			logger .debug ("Validating message ["  + soapMessage  + "] with actions ["  + validationActions  + "]" );
701713		}
@@ -756,6 +768,7 @@ protected void validateMessage(SoapMessage soapMessage, MessageContext messageCo
756768	 */ 
757769	protected  void  checkResults (List <WSSecurityEngineResult > results , List <Integer > validationActions )
758770			throws  Wss4jSecurityValidationException  {
771+ 
759772		if  (!handler .checkReceiverResultsAnyOrder (results , validationActions )) {
760773			throw  new  Wss4jSecurityValidationException ("Security processing failed (actions mismatch)" );
761774		}
@@ -767,6 +780,7 @@ protected void checkResults(List<WSSecurityEngineResult> results, List<Integer>
767780	 */ 
768781	@ SuppressWarnings ("unchecked" )
769782	private  void  updateContextWithResults (MessageContext  messageContext , List <WSSecurityEngineResult > results ) {
783+ 
770784		List <WSHandlerResult > handlerResults ;
771785		if  ((handlerResults  = (List <WSHandlerResult >) messageContext 
772786				.getProperty (WSHandlerConstants .RECV_RESULTS )) == null ) {
@@ -785,6 +799,7 @@ private void updateContextWithResults(MessageContext messageContext, List<WSSecu
785799	 * @param result 
786800	 */ 
787801	protected  void  verifyCertificateTrust (WSHandlerResult  result ) throws  WSSecurityException  {
802+ 
788803		List <WSSecurityEngineResult > results  = result .getActionResults ().get (WSConstants .SIGN );
789804
790805		if  (!CollectionUtils .isEmpty (results )) {
@@ -808,6 +823,7 @@ protected void verifyCertificateTrust(WSHandlerResult result) throws WSSecurityE
808823	 * @param result 
809824	 */ 
810825	protected  void  verifyTimestamp (WSHandlerResult  result ) throws  WSSecurityException  {
826+ 
811827		List <WSSecurityEngineResult > results  = result .getActionResults ().get (WSConstants .TS );
812828
813829		if  (!CollectionUtils .isEmpty (results )) {
@@ -830,6 +846,7 @@ protected void verifyTimestamp(WSHandlerResult result) throws WSSecurityExceptio
830846	}
831847
832848	private  void  processPrincipal (WSHandlerResult  result ) {
849+ 
833850		List <WSSecurityEngineResult > results  = result .getActionResults ().get (WSConstants .UT );
834851
835852		if  (!CollectionUtils .isEmpty (results )) {
@@ -851,6 +868,7 @@ private void processPrincipal(WSHandlerResult result) {
851868
852869	@ Override 
853870	protected  void  cleanUp () {
871+ 
854872		if  (validationCallbackHandler  != null ) {
855873			try  {
856874				CleanupCallback  cleanupCallback  = new  CleanupCallback ();
0 commit comments