Add authentication page

This commit is contained in:
jvyden 2021-11-20 02:54:22 -05:00
commit bf759713bd
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
6 changed files with 70 additions and 1 deletions

View file

@ -78,7 +78,9 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MM/@EntryIndexedValue">MM</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MM/@EntryIndexedValue">MM</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NAT/@EntryIndexedValue">NAT</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NAT/@EntryIndexedValue">NAT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NP/@EntryIndexedValue">NP</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NP/@EntryIndexedValue">NP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PS/@EntryIndexedValue">PS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PSP/@EntryIndexedValue">PSP</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PSP/@EntryIndexedValue">PSP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=RPCS/@EntryIndexedValue">RPCS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Method/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Method/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateConstants/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>

View file

@ -0,0 +1,18 @@
@page "/authentication"
@using LBPUnion.ProjectLighthouse.Types
@model LBPUnion.ProjectLighthouse.Pages.ExternalAuth.AuthenticationPage
@{
Layout = "Layouts/BaseLayout";
}
<br>
@foreach (AuthenticationAttempt authAttempt in Model.AuthenticationAttempts)
{
<div style="background-color: lightgray; display: flex; flex-direction: column; vertical-align: center; padding: 3px;">
<p style="margin: 0px">A <b>@authAttempt.Platform</b> authentication request was logged at <b>@authAttempt.Timestamp</b> from the IP address <b>@authAttempt.IPAddress</b>.</p>
<div>
<a href="/">Approve</a>
<a href="/">Deny</a>
</div>
</div>
}

View file

@ -0,0 +1,30 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Pages.Layouts;
using LBPUnion.ProjectLighthouse.Types;
using Microsoft.AspNetCore.Mvc;
namespace LBPUnion.ProjectLighthouse.Pages.ExternalAuth
{
public class AuthenticationPage : BaseLayout
{
public AuthenticationPage(Database database) : base(database)
{}
public List<AuthenticationAttempt> AuthenticationAttempts = new()
{
new AuthenticationAttempt
{
Platform = Platform.RPCS3,
Timestamp = TimestampHelper.Timestamp,
IPAddress = "127.0.0.1",
},
};
public async Task<IActionResult> OnGet()
{
return this.Page();
}
}
}

View file

@ -12,7 +12,8 @@
} }
else else
{ {
Model.NavigationItems.Add(new PageNavigationItem("Log out", "/logout")); Model.NavigationItems.Add(new PageNavigationItem("Authentication", "/authentication"));
Model.NavigationItems.Add(new PageNavigationItem("Log out", "/logout")); // should always be last
} }
} }

View file

@ -0,0 +1,10 @@
namespace LBPUnion.ProjectLighthouse.Types
{
public class AuthenticationAttempt
{
public long Timestamp;
public Platform Platform;
public string IPAddress;
public GameToken GameToken;
}
}

View file

@ -0,0 +1,8 @@
namespace LBPUnion.ProjectLighthouse.Types
{
public enum Platform
{
PS3,
RPCS3,
}
}