---
title: Split a Windows identity name
summary: Split a DOMAIN\\user identity name into domain and account parts.
status: draft
owner: saif-docgen
last_reviewed: 2026-09-15
library: SAIF.Framework.Common
reference_type: package
operation_id: OP-030
trigger: Caller has an authenticated `IIdentity` and needs the bare account name or the domain
---

# Split a Windows identity name

Split a DOMAIN\\user identity name into domain and account parts, triggered when caller has an authenticated `IIdentity` and needs the bare account name or the domain.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-030 |
| **Trigger** | Caller has an authenticated `IIdentity` and needs the bare account name or the domain |
| **Inputs** | `IIdentity` |
| **Outputs** | `string` |
| **Primary components** | ``SecurityPrincipalExtensions.UserId(this IIdentity)`, `SecurityPrincipalExtensions.Domain(this IIdentity)`` |
| **Entry point** | `Common/SAIF.Common/Extensions/SecurityPrincipalExtensions.cs` |

## Steps

1. Split `identity.Name` on the backslash character. ([BR-071](../business-rules.md#br-071-a-windows-identity-name-is-interpreted-as-domain%5Cuser))
2. `UserId` returns the last element (the account portion of `DOMAIN\user`), or `null` if the name is empty. ([BR-071](../business-rules.md#br-071-a-windows-identity-name-is-interpreted-as-domain%5Cuser))
3. `Domain` returns the first element (the domain portion), or `null` if the name is empty. ([BR-071](../business-rules.md#br-071-a-windows-identity-name-is-interpreted-as-domain%5Cuser))

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["Caller has an authenticated<br>IIdentity and needs the<br>account name or domain"]) --> S1["Split identity.Name<br>on backslash character"]
	S1 --> D1{"Which accessor<br>is called?"}
	D1 -->|UserId| D2{"Name is empty?"}
	D2 -->|Yes| R1(["Return null"])
	D2 -->|No| R2(["Return last element<br>(account portion)"])
	D1 -->|Domain| D3{"Name is empty?"}
	D3 -->|Yes| R3(["Return null"])
	D3 -->|No| R4(["Return first element<br>(domain portion)"])
	R1 --> End([Done])
	R2 --> End
	R3 --> End
	R4 --> End
```

## Failure and edge-case behavior

- These are string-parsing helpers only. They perform no authentication, no group lookup, and no authorization decision.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- `Common/SAIF.Common/Extensions/SecurityPrincipalExtensions.cs`
