Added a auth app

This commit is contained in:
BOT Alex 2023-08-23 00:54:11 +02:00
parent ec1274df7f
commit 1df4d64edf
859 changed files with 14249 additions and 965 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

11
Authenticator/App.razor Normal file
View File

@ -0,0 +1,11 @@
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>

View File

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.2" PrivateAssets="all" />
<PackageReference Include="MudBlazor" Version="6.0.6" />
</ItemGroup>
<ItemGroup>
<ServiceWorker Include="wwwroot\service-worker.js" PublishedContent="wwwroot\service-worker.published.js" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31717.71
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authenticator", "Authenticator.csproj", "{BE8AE6C9-BE8F-424A-9FE1-14F13E13243A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BE8AE6C9-BE8F-424A-9FE1-14F13E13243A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE8AE6C9-BE8F-424A-9FE1-14F13E13243A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE8AE6C9-BE8F-424A-9FE1-14F13E13243A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE8AE6C9-BE8F-424A-9FE1-14F13E13243A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DEABC887-95C9-4ED2-A439-A3BD57791E38}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,60 @@
@page "/"
@using System.Text;
@inject NavigationManager navigator
<PageTitle>Code</PageTitle>
<MudText Typo="Typo.h3" GutterBottom="true">Here's your code</MudText>
@* <MudText Typo="Typo.subtitle1">IMPORTANT: Take only 17 charecters from anywhere in the code!</MudText>*@
<MudPaper Class="pa-4" >
<MudText Class="mb-8 flex-wrap" Typo="Typo.body1" Style="word-wrap:break-word;">@authCode</MudText>
</MudPaper>
@if (verified)
{
<MudText Typo="Typo.body2"> Verified!</MudText>
}
@code {
string authCode = "";
bool verified = false;
protected override async Task OnInitializedAsync()
{
string semiCode = GetCode();
string guess = semiCode.Skip(15).Take(17).ToString();
if (authCode.Contains(guess))
verified = true;
await Task.Delay(30000);
navigator.NavigateTo("", true);
}
public string GetCode()
{
var time = DateTime.Now;
Random random = new Random(time.Hour);
var sb = new StringBuilder();
for (int i = 0; i < 100; i++)
{
string salt = (i + random.NextDouble()).ToString();
sb.AppendLine(salt);
}
string semicode = Base64Encode(time.ToString("HH") + sb.ToString());
semicode = semicode.Trim('=');
authCode = semicode;
return semicode;
}
public static string Base64Encode(string plainText)
{
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
return System.Convert.ToBase64String(plainTextBytes);
}
}

13
Authenticator/Program.cs Normal file
View File

@ -0,0 +1,13 @@
using Authenticator;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using MudBlazor.Services;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddMudServices();
await builder.Build().RunAsync();

View File

@ -0,0 +1,30 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:65283",
"sslPort": 44398
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Mudblazor.Template": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,13 @@
@inherits LayoutComponentBase
<MudThemeProvider IsDarkMode=true />
<MudDialogProvider />
<MudSnackbarProvider />
<MudLayout>
<MudMainContent>
<MudContainer MaxWidth="MaxWidth.Large" Class="my-16 pt-16">
@Body
</MudContainer>
</MudMainContent>
</MudLayout>

View File

@ -0,0 +1,11 @@
@using System.Net.Http
@using System.Net.Http.Json
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.AspNetCore.Components.WebAssembly.Http
@using Microsoft.JSInterop
@using MudBlazor
@using Authenticator
@using Authenticator.Shared

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More