DeviceClientConfig

public struct DeviceClientConfig : Sendable

Configuration for DeviceClient

This struct encapsulates all configuration needed to initialize and operate the DeviceClient. All properties are required to ensure proper authentication and routing of device management requests.

Example:

let config = DeviceClientConfig(
    serverUrl: "https://openam.example.com",
    realm: "alpha",
    cookieName: "iPlanetDirectoryPro",
    ssoToken: "AQIC5w...",
    httpClient: HttpClient()
)

Server Configuration

  • The base URL of the server

    Declaration

    Swift

    public let serverUrl: String
  • The realm to use for device operations

    Declaration

    Swift

    public let realm: String
  • Cookie name for server configuration

    Declaration

    Swift

    public let cookieName: String

Authentication

  • The SSO (Single Sign-On) session token

    Note

    Token validity is not checked by DeviceClient; ensure token is valid before use

    Declaration

    Swift

    public let ssoToken: String

Network Configuration

  • The HTTP client used for network requests

    Default: Creates a new HttpClientProtocol instance with default configuration

    Declaration

    Swift

    public let httpClient: HttpClientProtocol

Initialization

  • Initializes a new DeviceClientConfig

    Creates a complete configuration for the DeviceClient with all required parameters.

    Throws

    Does not throw, but invalid URLs or tokens will cause runtime errors during API calls

    Declaration

    Swift

    public init(
        serverUrl: String,
        realm: String = DeviceClientConstants.defaultRealm,
        cookieName: String = DeviceClientConstants.defaultCookieName,
        ssoToken: String,
        httpClient: HttpClientProtocol = HttpClient.createClient()
    )

    Parameters

    serverUrl

    The base URL of the server (e.g., "https://openam.example.com")

    realm

    The realm for device operations (e.g., "alpha")

    cookieName

    The header name for the SSO token (e.g., "iPlanetDirectoryPro")

    ssoToken

    The SSO session token for authentication

    httpClient

    The HTTP client instance (default: HttpClient.createClient())