API Gateway Authentication Extension
home
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 retrieved 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.
Namespace
<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">
Operations
- Set authentication
- Add properties
Set Authentication
This operation sets new authentication information to the Mule event. The opeation overwrites any existing authentication data.
Parameters
principal
(Optional)
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.
credentials
(Optional)
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.
properties
(Optional)
A DataWeave 2.0 expression that resolves to a Map of properties to be set to the authentication object.
Example
<authentication:set-authentication principal="Principal" credentials="Skinner"
properties="#[
'FirstProperty': 'FirstPropertyValue',
'SecondProperty': 'SecondPropertyValue'
]"/>
Add Properties
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.
Parameters
newProperties
(Optional)
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.
Example
<authentication:add-properties newProperties="#[
'FirstProperty': 'FirstPropertyValue',
'SecondProperty': 'SecondPropertyValue'
]"/>