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 outsidePolicySecurityServiceitself.*
Context¶
- Namespace: (global namespace — the type is declared outside any
namespaceblock) - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet 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, andPRODUCER_USERconstants directly fromPolicySecurityService, which are declaredinternalin that class and therefore only accessible to types in the same assembly. - The
CA1062:Validate arguments of public methodssuppression onIsAgentindicates the method does not null-check itstargetparameter before callingIsAuthorized.*
Constraints and usage notes¶
- Calling
IsAgentwith anulltarget profile will throw aNullReferenceExceptionrather 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