-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from drasticactions/internal-password
Make CreateSessionAsync internal
- Loading branch information
Showing
8 changed files
with
130 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<PublishAot>true</PublishAot> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="ConsoleAppFramework"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\FishyFlip\FishyFlip.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.0.31903.59 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PasswordAuth", "PasswordAuth.csproj", "{CA58096E-487C-4C4B-B72F-FC5A48AD6A4B}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FishyFlip", "..\..\src\FishyFlip\FishyFlip.csproj", "{7E7D4B52-3C34-430A-AA04-E3E77852F052}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{CA58096E-487C-4C4B-B72F-FC5A48AD6A4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{CA58096E-487C-4C4B-B72F-FC5A48AD6A4B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{CA58096E-487C-4C4B-B72F-FC5A48AD6A4B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{CA58096E-487C-4C4B-B72F-FC5A48AD6A4B}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{7E7D4B52-3C34-430A-AA04-E3E77852F052}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{7E7D4B52-3C34-430A-AA04-E3E77852F052}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{7E7D4B52-3C34-430A-AA04-E3E77852F052}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{7E7D4B52-3C34-430A-AA04-E3E77852F052}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using ConsoleAppFramework; | ||
using FishyFlip; | ||
using Microsoft.Extensions.Logging.Debug; | ||
|
||
var app = ConsoleApp.Create(); | ||
app.Add<AppCommands>(); | ||
app.Run(args); | ||
|
||
/// <summary> | ||
/// App Commands. | ||
/// </summary> | ||
#pragma warning disable SA1649 // File name should match first type name | ||
public class AppCommands | ||
#pragma warning restore SA1649 // File name should match first type name | ||
{ | ||
/// <summary> | ||
/// Authenticate with the ATProtocol using a password. | ||
/// </summary> | ||
/// <param name="identifier">The user's identifier.</param> | ||
/// <param name="password">The user's password.</param> | ||
/// <param name="cancellationToken">Cancellation Token.</param> | ||
/// <returns>Task.</returns> | ||
[Command("authenticate")] | ||
public async Task AuthenticateAsync([Argument] string identifier, [Argument] string password, CancellationToken cancellationToken = default) | ||
{ | ||
var protocol = new ATProtocolBuilder() | ||
.WithLogger(new DebugLoggerProvider().CreateLogger("FishyFlip")) | ||
.Build(); | ||
|
||
var session = await protocol.AuthenticateWithPasswordAsync(identifier, password, cancellationToken); | ||
if (session is null) | ||
{ | ||
Console.WriteLine("Failed to authenticate."); | ||
return; | ||
} | ||
|
||
Console.WriteLine("Authenticated."); | ||
Console.WriteLine($"Session Did: {session.Did}"); | ||
Console.WriteLine($"Session Email: {session.Email}"); | ||
Console.WriteLine($"Session Handle: {session.Handle}"); | ||
Console.WriteLine($"Session Token: {session.AccessJwt}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters