Event Authentication Extension
The Event Authentication extension for Mule 4 enables policies to easily update the authentication data of the Mule Event to propagate information using the flow pipeline. A common use case for this scenario is applying a OAuth policy with a Rate Limiting SLA Based policy. In this use case, the first policy validates a token provided in the request. If the token is valid, the client ID is retreived from the provider and saved in the Event authentication object. This authentication data is then used by the Rate Limiting policy to verify that the client application corresponding to the client credential has not reached its quota limit.
<mule xmlns:authentication="http://www.mulesoft.org/schema/mule/authentication" xsi:schemaLocation=" http://www.mulesoft.org/schema/mule/authentication http://www.mulesoft.org/schema/mule/authentication/current/mule-authentication.xsd">
This operation sets new authentication information to the Mule event. The opeation overwrites any existing authentication data.
A string that is used to store the identity of a subject in an authentication process, for example, a username or a client ID attribute. If not specified, a null value is stored in the parameter.
A string that is used to store the verification data of a subject in an authentication process, for example, a password or a client secret attribute. If not specified, the parameter defaults to an empty string.
A DataWeave 2.0 expression that resolves to a Map of properties to be set to the authentication object.
<authentication:set-authentication principal="Principal" credentials="Skinner" properties="#[ 'FirstProperty': 'FirstPropertyValue', 'SecondProperty': 'SecondPropertyValue' ]"/>
This operation adds properties to the current Authentication object of the Mule Event. If a match is found, the properties are overwritten. If does not already exist, the Authentication object is created with the specified properties, empty credentials, and a null principal.
A DataWeave 2.0 expression that resolves to a Map of properties to be added to the Authentication object. If not specified, no operation is performed.
<authentication:add-properties newProperties="#[ 'FirstProperty': 'FirstPropertyValue', 'SecondProperty': 'SecondPropertyValue' ]"/>