Added ControllerExtensions to be used instead of HtmlViewRenderer for net8
Added HttpException class for missing HttpException for net8 Wrapped HttpContext.Session, GetJsonResult, IsAjaxRequest and GetUserIdentityName in controllers for net8 Added AuthenticationService to test Fab2ApprovalMKLink code for net8 Compile conditionally flags to debug in dotnet core
This commit is contained in:
@ -26,6 +26,9 @@ public class AppSettings {
|
||||
string ifxContainer,
|
||||
string ifxDomain,
|
||||
bool isInfineonDomain,
|
||||
string? jwtAudience,
|
||||
string? jwtIssuer,
|
||||
string? jwtKey,
|
||||
string lotTempPipeLine,
|
||||
string mesaTemplateFiles,
|
||||
string nDriveURL,
|
||||
@ -68,6 +71,9 @@ public class AppSettings {
|
||||
IFXContainer = ifxContainer;
|
||||
IFXDomain = ifxDomain;
|
||||
IsInfineonDomain = isInfineonDomain;
|
||||
JwtAudience = jwtAudience;
|
||||
JwtIssuer = jwtIssuer;
|
||||
JwtKey = jwtKey;
|
||||
LotTempPipeLine = lotTempPipeLine;
|
||||
MesaTemplateFiles = mesaTemplateFiles;
|
||||
NDriveURL = nDriveURL;
|
||||
@ -112,6 +118,9 @@ public class AppSettings {
|
||||
public string IFXContainer { get; }
|
||||
public string IFXDomain { get; }
|
||||
public bool IsInfineonDomain { get; }
|
||||
public string? JwtAudience { get; }
|
||||
public string? JwtIssuer { get; }
|
||||
public string? JwtKey { get; }
|
||||
public string LotTempPipeLine { get; }
|
||||
public string MesaTemplateFiles { get; }
|
||||
public string NAContainer { get; }
|
||||
@ -223,6 +232,9 @@ public class AppSettings {
|
||||
string? workingDirectoryName = ConfigurationManager.AppSettings["WorkingDirectoryName"]?.ToString();
|
||||
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
||||
"https://localhost:7255";
|
||||
string? jwtAudience = ConfigurationManager.AppSettings["JwtAudience"]?.ToString();
|
||||
string? jwtIssuer = ConfigurationManager.AppSettings["JwtIssuer"]?.ToString();
|
||||
string? jwtKey = ConfigurationManager.AppSettings["JwtKey"]?.ToString();
|
||||
result = new(adminNotificationRecepient: adminNotificationRecepient,
|
||||
apiBaseUrl: apiBaseUrl,
|
||||
attachmentFolder: attachmentFolder,
|
||||
@ -242,6 +254,9 @@ public class AppSettings {
|
||||
ifxContainer: ifxContainer,
|
||||
ifxDomain: ifxDomain,
|
||||
isInfineonDomain: Misc.GlobalVars.IS_INFINEON_DOMAIN,
|
||||
jwtAudience: jwtAudience,
|
||||
jwtIssuer: jwtIssuer,
|
||||
jwtKey: jwtKey,
|
||||
lotTempPipeLine: lotTempPipeLine,
|
||||
mesaTemplateFiles: Misc.GlobalVars.MesaTemplateFiles,
|
||||
naContainer: naContainer,
|
||||
|
37
Fab2ApprovalSystem/Models/HttpException.cs
Normal file
37
Fab2ApprovalSystem/Models/HttpException.cs
Normal file
@ -0,0 +1,37 @@
|
||||
#if NET8
|
||||
|
||||
using System;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models;
|
||||
|
||||
public class HttpException : Exception {
|
||||
private readonly int httpStatusCode;
|
||||
|
||||
public HttpException(int httpStatusCode) {
|
||||
this.httpStatusCode = httpStatusCode;
|
||||
}
|
||||
|
||||
public HttpException(System.Net.HttpStatusCode httpStatusCode) {
|
||||
this.httpStatusCode = (int)httpStatusCode;
|
||||
}
|
||||
|
||||
public HttpException(int httpStatusCode, string message) : base(message) {
|
||||
this.httpStatusCode = httpStatusCode;
|
||||
}
|
||||
|
||||
public HttpException(System.Net.HttpStatusCode httpStatusCode, string message) : base(message) {
|
||||
this.httpStatusCode = (int)httpStatusCode;
|
||||
}
|
||||
|
||||
public HttpException(int httpStatusCode, string message, Exception inner) : base(message, inner) {
|
||||
this.httpStatusCode = httpStatusCode;
|
||||
}
|
||||
|
||||
public HttpException(System.Net.HttpStatusCode httpStatusCode, string message, Exception inner) : base(message, inner) {
|
||||
this.httpStatusCode = (int)httpStatusCode;
|
||||
}
|
||||
|
||||
public int StatusCode { get { return httpStatusCode; } }
|
||||
}
|
||||
|
||||
#endif
|
@ -3,6 +3,7 @@
|
||||
public class LoginResult {
|
||||
|
||||
public bool IsAuthenticated { get; set; }
|
||||
public User User { get; set; }
|
||||
public AuthTokens AuthTokens { get; set; }
|
||||
|
||||
}
|
30
Fab2ApprovalSystem/Models/User.cs
Normal file
30
Fab2ApprovalSystem/Models/User.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
|
||||
namespace Fab2ApprovalSystem.Models;
|
||||
|
||||
public class User {
|
||||
public int UserID { get; set; }
|
||||
public string LoginID { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string Email { get; set; }
|
||||
public bool IsAdmin { get; set; } = false;
|
||||
public bool IsManager { get; set; } = false;
|
||||
public bool IsActive { get; set; } = false;
|
||||
public bool OOO { get; set; } = false;
|
||||
public DateTime OOOStartDate { get; set; }
|
||||
public DateTime OOOExpirationDate { get; set; }
|
||||
public int DelegatedTo { get; set; }
|
||||
|
||||
public string GetFullName() =>
|
||||
$"{FirstName} {LastName}";
|
||||
|
||||
public override bool Equals(object? obj) {
|
||||
User? u = obj as User;
|
||||
|
||||
return u is not null && u.UserID == UserID;
|
||||
}
|
||||
|
||||
public override int GetHashCode() =>
|
||||
UserID.GetHashCode();
|
||||
}
|
Reference in New Issue
Block a user