> Source: https://docs.cyberelements.io/bastion/4.6/Usage/AdminConsoleReference/SsoPreAuthRequest/

# Pre-authentication Web SSO request

> **Internal window of the Applications module**
>
> This window is reached from the **Applications** module, on an application whose service type is **Web** and whose **SSO type** is **Pre-authentication**: the **Configure pre-authentication steps** button opens the list of steps, where the **+** button adds a request. The window carries a help icon that opens the module help page.

The **Pre-authentication Web SSO request** window lets an administrator define an **HTTP request** that the Mediation Controller must send to the target server before the final authentication step of a Web SSO application. A simplified variant is used for the **final redirect** to the application server.

Every request is identified in the list of steps by its **URL**, its **method** and its **sending order** — that order is what the `%reqresult()%` substitution described in section [Special syntax of values](#special-syntax-of-values) refers to.

## Main fields

| Field | Description |
|---|---|
| **URL** | URL automatically prefixed with the already known target server address (the prefix is truncated for display when the string exceeds 100 characters). In **final redirect** mode, the URL cannot be edited. |
| **Method** | Mandatory. Choices: **GET** or **POST** *(default)*. |
| **Content type (MIME)** | MIME type of the request body. Default value: `application/x-www-form-urlencoded`. Other choices: `application/json`, `application/xml`, `text/html`, `text/plain`, `text/richtext`, `text/tab-separated-values`. Hidden and disabled in **final redirect** mode. |
| **Enable cache** | Checkbox, checked by default. Hidden and disabled in **final redirect** mode. |
| **Login parameter** | Name of the parameter that must carry the login. Only enabled when the content type accepts parameters, that is `application/x-www-form-urlencoded`. |
| **Password parameter** | Name of the parameter that must carry the password. Same enabling rules as above. |
| **Advanced settings** | Checkbox. Shows or hides the advanced data tabs. Forced on when the current content type does not accept simple parameters. |

## Advanced settings tabs

When **Advanced settings** is on, a tab panel appears. Its visibility depends on the content type and on the mode (regular request or final redirect).

**Parameters**

> Visible when editing the **final redirect**, or when the content type accepts parameters (`application/x-www-form-urlencoded`).
>
> The upper form adds an entry to the grid below, whose columns are **Name** and **Value**; when empty it reads **No element to display**. A delete icon on each row removes the entry.
>
> | Field | Description |
> |---|---|
> | **Name** | Parameter name. |
> | **Value** | Matching value. A message below the field recalls that **This field follows a special syntax. Please consult the help page for more informations.** See section [Special syntax of values](#special-syntax-of-values). |
> | **Disable special syntax** | Checkbox: the value is then taken as is, and the syntax message disappears. Entries added this way are shown **in italics** in the grid. |
> | **Handle as JSON data** | Checkbox. The value is treated as a JSON object. |
> | **Add** | Inserts the entry into the grid. |

**Content**

> Visible when not editing the final redirect **and** when the content type does not accept simple parameters (`application/json`, for instance).
>
> | Field | Description |
> |---|---|
> | **Content** | Multi-line text area, synchronised in real time. The same special-syntax message is recalled. |
> | **Disable special syntax** | Checkbox: the content is then taken as is. |

**Headers**

> Visible when not editing the final redirect.
>
> The form is identical to the **Parameters** tab: **Name**, **Value**, **Disable special syntax**, **Handle as JSON data**, the **Add** button, and a grid with per-row deletion.

The **Previous** and **Next** buttons move between the visible tabs.

## Special syntax of values

The **Value** fields (**Parameters** and **Headers** tabs) and the **Content** field accept substitution strings, replaced when the SSO runs. The same syntax applies to [pre-authentication data](https://docs.cyberelements.io/bastion/4.6/Usage/AdminConsoleReference/SsoPreAuthData/).

| Substitution | Effect |
|---|---|
| `%user%` | Login to use for the SSO. |
| `%password%` | Password to use for the SSO. |
| `%base64([...])%` | Encodes the content of the brackets in base 64. |
| `%lowercase([...])%` | Turns the content into lowercase. |
| `%uppercase([...])%` | Turns the content into uppercase. |
| `%trim([...])%` | Removes leading and trailing whitespace from the content. |
| `%uriencoded([...])%` | Replaces uncommon special characters with their UTF-8 encoding, for use in a URL. |

Encryption functions are available as well:

| Function | Expected parameters |
|---|---|
| `%sha256([...])%` | The data to hash (SHA-256). |
| `%md5([...])%` | The data to hash (MD5). |
| `%hmacmd5([...])%` | Two parameters: the data to encrypt, then the encryption key. |
| `%rsa([...])%` | Two parameters: the public key, then the data to encrypt. |
| `%rsaoaep([...])%` | Two parameters: the public key in PEM format, then the string to encrypt. |
| `%reqresult([...])%` | The sequence number of the request whose result must be reused and, optionally, the name of the key to pick when that result carries several parameters. |

> **Two writing conventions**
>
> Function parameters are separated by **`%,%`**. To enter a literal percent sign, write **`\%`**.

## Saving

Click **Validate** to add or update the request in the current pre-authentication step. **Cancel** closes the window without saving.

> **Height adaptation**
>
> The window resizes automatically depending on the mode: short form when **Advanced settings** is off or in redirect mode, tall form when the tab panel is visible.
