Class PolicyEnforcer

java.lang.Object
org.apache.wss4j.policy.stax.enforcer.PolicyEnforcer
All Implemented Interfaces:
org.apache.xml.security.stax.securityEvent.SecurityEventListener

public class PolicyEnforcer extends Object implements org.apache.xml.security.stax.securityEvent.SecurityEventListener
The PolicyEnforcer verifies the Policy assertions The Assertion will be validated in realtime as far as possible
  • Field Details

    • FAIL_ON_UNSUPPORTED_ASSERTIONS_PROPERTY

      public static final String FAIL_ON_UNSUPPORTED_ASSERTIONS_PROPERTY
      System property controlling how policy assertions which this enforcer cannot enforce are handled. The default ("false") logs a warning and skips the assertion (the historical behaviour). When set to "true", building the assertion state map fails with a WSSPolicyException instead, so that the server cannot silently enforce less than the policy it advertises.
      See Also:
  • Constructor Details

    • PolicyEnforcer

      public PolicyEnforcer(List<OperationPolicy> operationPolicies, String soapAction, boolean initiator, String actorOrRole, int attachmentCount, PolicyAsserter policyAsserter, boolean soap12) throws org.apache.wss4j.common.WSSPolicyException
      Throws:
      org.apache.wss4j.common.WSSPolicyException
  • Method Details

    • getAssertableForAssertion

      protected List<Assertable> getAssertableForAssertion(org.apache.wss4j.policy.model.AbstractSecurityAssertion abstractSecurityAssertion) throws org.apache.wss4j.common.WSSPolicyException
      Throws:
      org.apache.wss4j.common.WSSPolicyException
    • registerSecurityEvent

      public void registerSecurityEvent(org.apache.xml.security.stax.securityEvent.SecurityEvent securityEvent) throws org.apache.wss4j.common.ext.WSSecurityException
      Specified by:
      registerSecurityEvent in interface org.apache.xml.security.stax.securityEvent.SecurityEventListener
      Throws:
      org.apache.wss4j.common.ext.WSSecurityException
    • doFinal

      public void doFinal() throws org.apache.wss4j.common.WSSPolicyException
      the final Policy validation to find a satisfied alternative
      Throws:
      PolicyViolationException - if no alternative could be satisfied
      org.apache.wss4j.common.WSSPolicyException
    • isUsernameTokenNoPasswordAllowedByPolicy

      public boolean isUsernameTokenNoPasswordAllowedByPolicy()
      Returns true if the policy that governs this message contains a UsernameToken assertion that explicitly allows password-less tokens (sp:NoPassword). Used to decide whether the engine's hardened default (rejecting password-less UsernameTokens) may be relaxed in policy mode. This is asked while the security header is being read, so the operation is known only where SOAPAction already selected its policy. Failing that the question can be answered across the configured operations and no more, which relaxes the default for a message that may turn out to invoke an operation whose own policy does not allow it. Record that, so that verifyRelaxedEngineDefaults() can reimpose the default once the operation is known.
    • isRSA15KeyTransportAllowedByPolicy

      public boolean isRSA15KeyTransportAllowedByPolicy()
      Returns true if the policy that governs this message contains an AlgorithmSuite whose asymmetric key wrap is RSA v1.5. Used to decide whether the engine's hardened default (rejecting rsa-1_5 key transport) may be relaxed in policy mode. Scoped to the operation, and recorded when it cannot be, exactly as above.