---
schema_version: "1"
id: 9250dc432cc5b23e733edcd8149b78581e406e270eaa6909b2cc27433aa92cc1
title: Accessing Request Authentication Information
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/pdk/1.2/policies-pdk-configure-features-authentication.md
canonical_url: https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features-authentication
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 5ef627619df234c9c2b52610991d5b4f76b42e3ef5ffc8d7c6b24b2f5d58ec78
description: MuleSoft Documentation Site
release: "1.2"
latest: false
---
---
product: Omni Gateway Policy Development Kit (PDK)
version: 1.2
---

# Accessing Request Authentication Information

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

The `Authentication` injectable provides an interface to:

- Propagate authentication data for consumption by other policies.

- Consume authentication data already set by another policy.

To share data, `Authentication` implements the `AuthenticationHandler` trait:

```Rust
pub trait AuthenticationHandler {
    fn authentication(&self) -> Option<AuthenticationData>;
    fn set_authentication(&self, authentication: Option<&AuthenticationData>);
}
```

The `AuthenticationData` struct contains the following authentication data:

```Rust
pub struct AuthenticationData {
    pub principal: Option<String>,
    pub client_id: Option<String>,
    pub client_name: Option<String>,
    pub properties: Value,
}
```

For example, the following code reads the `Authentication` data and modifies it by overriding the
`client_id` and `client_name`:

```Rust
async fn request_filter(state: RequestState, authentication: Authentication) -> Flow<()> {
    let state = state.into_headers_state().await;
    let header_handler = state.handler();

    let auth = authentication.authentication().unwrap_or_default();

    let properties = auth.properties.as_object().cloned().unwrap_or_default();

    let client_id = header_handler
        .header("custom_client_id_header")
        .unwrap_or_default();
    let client_name = header_handler
        .header("custom_client_name_header")
        .unwrap_or_default();

    let auth = AuthenticationData::new(
        auth.principal,
        Some(client_id),
        Some(client_name),
        properties
    );

    authentication.set_authentication(Some(&auth));

    Flow::Continue(())
}

#[entrypoint]
async fn configure(launcher: Launcher) -> Result<()> {
    let filter = on_request(|rs, auth| request_filter(rs, auth));
    launcher.launch(filter).await?;
    Ok(())
}
```

## See Also

- [Injecting Parameters](https://docs.mulesoft.com/pdk/1.2/policies-pdk-configure-features-inject-parameters)
