---
title: SecurityExtensions
summary: API reference for SecurityExtensions.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# SecurityExtensions

Provides a single extension method, `IsAgent`, that classifies an `IApplicationUserProfile` as an agent-type external user by checking the same `AgencyExternal`, `ARPAgencyExternal`, and `ProducerExternal` authorization resources that `PolicySecurityService` uses internally for its own agent classification, letting other services (e.g. `CertificateSecurityService`) reuse the same rule without depending on `PolicySecurityService` directly.* The type is declared outside any namespace (in the global namespace), which is explicitly acknowledged by a `CA1050:DeclareTypesInNamespaces` suppression on the class.

## Purpose
- Determines whether a given user profile represents an agency, ARP agency, or producer (individual agent) user.
- Reuses `PolicySecurityService`'s internal agent-classification security-resource names so agent detection stays consistent across services that need it outside `PolicySecurityService` itself.*

## Context
- Namespace: (global namespace — the type is declared outside any `namespace` block)
- Assembly/package: `SAIF.Services` (packaged inside the `SAIF.SAIFCode.Core` NuGet package).

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| IsAgent | `public static bool IsAgent(this IApplicationUserProfile target)` | Returns `true` if the profile is authorized for the `AgencyExternal`, `ARPAgencyExternal`, or `ProducerExternal` security resources (i.e. any agent-type external user). |

## Behavioral notes
- Reads the `AGENT_USER`, `ARP_AGENT_USER`, and `PRODUCER_USER` constants directly from `PolicySecurityService`, which are declared `internal` in that class and therefore only accessible to types in the same assembly.
- The `CA1062:Validate arguments of public methods` suppression on `IsAgent` indicates the method does not null-check its `target` parameter before calling `IsAuthorized`.*

## Constraints and usage notes
- Calling `IsAgent` with a `null` target profile will throw a `NullReferenceException` rather than a guarded argument exception, since the parameter is not null-checked.*

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- `Services/SAIF.Services/Policies/SecurityServices/PolicySecurityService.cs`
