Public/ps1/Configuration/Authentication/Get-ApprxrAuthenticationId.ps1

<#
    .SYNOPSIS
    Generates or returns an authentication ID for Apprxr authentication scenarios.
 
    .DESCRIPTION
    Returns the provided ID if present, otherwise constructs an ID using the channelId and hostURI, or hostURI and type if channelId is not provided.
 
    .PARAMETER channelId
    The channel identifier to use in the authentication ID.
 
    .PARAMETER id
    The explicit ID to return if provided.
 
    .PARAMETER hostURI
    The host URI to use as part of the authentication ID.
 
    .PARAMETER type
    The type to use in the authentication ID if channelId is not provided.
 
    .EXAMPLE
    Get-ApprxrAuthenticationId -channelId 'abc' -hostURI 'https://example.com/' -type 'user'
 
    .NOTES
    Used internally for authentication and session management.
#>

function Get-ApprxrAuthenticationId {
    param (
        $channelId,
        $id,
        $hostURI,
        $type
    )
    if (-not $id) {
        if ($channelId) {
            $id = ($hostURI + $channelId)
        } else {
            $id = ($hostURI + $type)
        }
    }
    return $id
}