/* * SPDX-License-Identifier: AGPL-3.0-or-later * Copyright (C) 2025 Sergej Görzen * This file is part of OmiLAXR. */ using UnityEngine; namespace OmiLAXR.Endpoints { /// /// Represents credentials for Basic Authentication. /// Stores endpoint, username, and password for authentication purposes. /// [System.Serializable] public struct BasicAuthCredentials { /// /// The base URL or endpoint for the authentication service. /// public string endpoint; /// /// The username for authentication (alternatively called key). /// [Tooltip("Alternatively called key.")] public string username; /// /// The password for authentication (alternatively called secret). /// [Tooltip("Alternatively called secret.")] public string password; /// /// Constructs a new BasicAuthCredentials instance with the specified parameters. /// /// The authentication endpoint URL /// The authentication username /// The authentication password public BasicAuthCredentials(string endpoint, string username, string password) { this.endpoint = endpoint; this.username = username; this.password = password; } /// /// Checks if the credentials are valid by ensuring none of the fields are null or empty. /// public bool IsValid => !string.IsNullOrEmpty(endpoint) && !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password); /// /// Provides a string representation of the credentials for logging or debugging. /// Masks the actual password for security. /// /// A formatted string with credential information public override string ToString() { return $"[BasicAuthCredentials endpoint={endpoint}, username={username}, password={password}]"; } } }