Class MessagePolicy
java.lang.Object
jakarta.security.auth.message.MessagePolicy
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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDefines the level of protection to be applied to a message.static interfaceDefines how to extract target information from a message for policy evaluation.static classAssociates a set of targets with a protection policy. -
Constructor Summary
ConstructorsConstructorDescriptionMessagePolicy(MessagePolicy.TargetPolicy[] targetPolicies, boolean mandatory) Creates a newMessagePolicywith the specified target policies and mandatory flag. -
Method Summary
Modifier and TypeMethodDescriptionReturns the target policies associated with this message policy.booleanIndicates whether this policy is mandatory.
-
Constructor Details
-
MessagePolicy
Creates a newMessagePolicywith the specified target policies and mandatory flag.- Parameters:
targetPolicies- the array ofTargetPolicyobjects defining the policy requirements; must not benullmandatory-trueif the policy is mandatory and authentication must succeed;falseif the policy is optional- Throws:
IllegalArgumentException- iftargetPoliciesisnull
-
-
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:
trueif the policy is mandatory,falseotherwise
-
getTargetPolicies
Returns the target policies associated with this message policy.- Returns:
- an array of
TargetPolicyobjects, ornullif no target policies are defined
-