Skip to content

EnvironmentHost

EnvironmentHost resolves a Uri's host component into the naming convention expected by the Environment API — stripping domain suffixes, detecting IP-address hosts, and appending a port suffix for non-default ports.

Purpose

  • Normalize a URI's host into the short-name convention used to look up host-specific settings in the Environment API.

Context

  • Namespace: SAIF.Framework.Security
  • Assembly/package: SAIF.Framework.Security.EnvironmentApi

Public members

Member Signature Purpose
EnvironmentHost(uri) public EnvironmentHost(Uri uri) Constructs the resolver for the given URI.
ResolveHost public string ResolveHost() Returns the normalized host name: the DNS-safe host with any domain suffix stripped (unless it is an IP address), with -{port} appended when the URI does not use its scheme's default port.

Behavioral notes

  • IP-address hosts are detected by stripping . characters and testing whether the remainder parses as a number; such hosts are used as-is without domain stripping.
  • Domain stripping takes the first .-delimited segment of the host (e.g. webprod00.external.saif.com → webprod00), per the code comment describing this as a fix for host-lookup confusion caused by fully-qualified domain names.

Constraints and usage notes

  • Used to compute a consistent host key for settings lookup regardless of whether the caller supplies a bare hostname, an FQDN, or an IP address.

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

  • SAIF.Framework.Security.EnvironmentApi\Services.Common\EnvironmentHost.cs