Class MessagePolicy

java.lang.Object
jakarta.security.auth.message.MessagePolicy

public class MessagePolicy extends Object
Defines the security policy requirements for a message-based authentication module. A MessagePolicy specifies the target policies that determine which messages require authentication and the level of protection required.
  • Constructor Details

    • MessagePolicy

      public MessagePolicy(MessagePolicy.TargetPolicy[] targetPolicies, boolean mandatory)
      Creates a new MessagePolicy with the specified target policies and mandatory flag.
      Parameters:
      targetPolicies - the array of TargetPolicy objects defining the policy requirements; must not be null
      mandatory - true if the policy is mandatory and authentication must succeed; false if the policy is optional
      Throws:
      IllegalArgumentException - if targetPolicies is null
  • Method Details

    • isMandatory

      public boolean isMandatory()
      Indicates whether this policy is mandatory. If mandatory, the authentication module must enforce the policy and authentication will fail if the policy cannot be satisfied.
      Returns:
      true if the policy is mandatory, false otherwise
    • getTargetPolicies

      public MessagePolicy.TargetPolicy[] getTargetPolicies()
      Returns the target policies associated with this message policy.
      Returns:
      an array of TargetPolicy objects, or null if no target policies are defined