mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +00:00
feat: enhance LoginRequestHandler to include detailed LoginResponse structure
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
9fc866741e
commit
e5e1802da9
2 changed files with 60 additions and 27 deletions
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp.CrestronAuthentication;
|
||||
using Crestron.SimplSharp.WebScripting;
|
||||
using Newtonsoft.Json;
|
||||
|
|
@ -91,7 +92,15 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
|||
context.Response.StatusDescription = "OK";
|
||||
context.Response.ContentType = "application/json";
|
||||
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||
context.Response.Write(JsonConvert.SerializeObject(new { Token = token }, Formatting.Indented), false);
|
||||
context.Response.Write(JsonConvert.SerializeObject(
|
||||
new LoginResponse
|
||||
{ UserName = token.UserName,
|
||||
Password = token.Password,
|
||||
Access = token.Access,
|
||||
State = token.State,
|
||||
Groups = token.Groups,
|
||||
ADConnect = token.ADConnect,
|
||||
Valid = token.Valid }, Formatting.Indented), false);
|
||||
context.Response.End();
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
|
|
@ -121,4 +130,45 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
|||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a LoginResponse
|
||||
/// </summary>
|
||||
internal class LoginResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the username.
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the password.
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the access level.
|
||||
/// </summary>
|
||||
public Authentication.UserAuthenticationLevelEnum Access { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the token authenticated state.
|
||||
/// </summary>
|
||||
public Authentication.eTokenAuthenticatedState State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list of groups.
|
||||
/// </summary>
|
||||
public List<string> Groups { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the active directory connection flag.
|
||||
/// </summary>
|
||||
public int ADConnect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the valid flag indicating whether the token is valid.
|
||||
/// </summary>
|
||||
public bool Valid { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue