ps/Modules/Alkami.Ops.SecretServer/Model/User.cs

40 lines
1.3 KiB
C#
Raw Permalink Normal View History

2023-05-30 22:51:22 -07:00
using System;
using System.Linq;
using Alkami.Ops.SecretServer.Enum;
using Alkami.Ops.SecretServer.SSWebService;
namespace Alkami.Ops.SecretServer.Model
{
/// <summary>
/// Represents a Windows Account secret
/// </summary>
public class User : SecretBase
{
/// <summary>
/// The secret type
/// </summary>
/// <remarks>
/// Returns <seealso cref="SecretType"/>.Certificate
/// </remarks>
public new SecretType SecretType => SecretType.User;
/// <summary>
/// The user name from the "Username" field on the secret
/// </summary>
public string UserName => SecretItems.FirstOrDefault(p => string.Equals(p.FieldName, "Username", StringComparison.OrdinalIgnoreCase))?.Value;
/// <summary>
/// The password from the "Password" field on the secret
/// </summary>
public string Password => SecretItems.FirstOrDefault(p => string.Equals(p.FieldName, "Password", StringComparison.OrdinalIgnoreCase) && p.IsPassword)?.Value;
/// <summary>
/// Instantiates a new instance of the Secret class
/// </summary>
/// <param name="secret"></param>
public User(Secret secret) : base(secret)
{
}
}
}