Skip to content

Commit

Permalink
Merge pull request #25 from TechLiam/v1.4.0
Browse files Browse the repository at this point in the history
V1.4.0
  • Loading branch information
TechLiam authored Oct 26, 2019
2 parents 6e60160 + 72ab4b3 commit dd39db5
Show file tree
Hide file tree
Showing 30 changed files with 319 additions and 56 deletions.
5 changes: 5 additions & 0 deletions Examples/AskMessage/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public void ConfigureServices(IServiceCollection services)
options.Diagnostics = true;
options.DisableDefaultLoginPage = true;
options.EnableHelpers = true;
options.HelpersPaths = new[]
{
new PathString("/"),
new PathString("/MessageMe")
};
options.OtherAuthenticationPaths = new OtherAuthenticationPath[]
{
new OtherAuthenticationPath()
Expand Down
4 changes: 4 additions & 0 deletions Examples/CustomLoginPageWithHtmlHelpers/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public void ConfigureServices(IServiceCollection services)
options.Diagnostics = true;
options.DisableDefaultLoginPage = true;
options.EnableHelpers = true;
options.HelpersPaths = new[]
{
new PathString("/"),
};
});

services.AddMvc(options =>
Expand Down
5 changes: 5 additions & 0 deletions Examples/HelpersProvidersAndOtherPaths/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public void ConfigureServices(IServiceCollection services)
options.Diagnostics = true;
options.DisableDefaultLoginPage = true;
options.EnableHelpers = true;
options.HelpersPaths = new[]
{
new PathString("/"),
new PathString("/OtherPathPage"),
};
options.OtherAuthenticationPaths = new OtherAuthenticationPath[]
{
new OtherAuthenticationPath()
Expand Down
9 changes: 9 additions & 0 deletions SQRL For Dot Net Standard.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AskMessage", "Examples\AskM
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WithDatabase", "Examples\WithDatabase\WithDatabase.csproj", "{95638D96-23D4-497B-AD0E-673EFDDCE533}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{A91452D4-A0C7-4D08-9440-7202D7A43744}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "Tests\UnitTests\UnitTests.csproj", "{E8CB8FD9-BD72-42CB-8EFF-D23BF6334061}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -59,6 +63,10 @@ Global
{95638D96-23D4-497B-AD0E-673EFDDCE533}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95638D96-23D4-497B-AD0E-673EFDDCE533}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95638D96-23D4-497B-AD0E-673EFDDCE533}.Release|Any CPU.Build.0 = Release|Any CPU
{E8CB8FD9-BD72-42CB-8EFF-D23BF6334061}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E8CB8FD9-BD72-42CB-8EFF-D23BF6334061}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8CB8FD9-BD72-42CB-8EFF-D23BF6334061}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8CB8FD9-BD72-42CB-8EFF-D23BF6334061}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -71,6 +79,7 @@ Global
{9C877057-4C85-4EB0-8921-EA54444A37D9} = {70FA3413-2862-425B-B8A2-D5E1E68822D7}
{A9D4C9DA-CD79-4B9A-A211-7B03A925E179} = {70FA3413-2862-425B-B8A2-D5E1E68822D7}
{95638D96-23D4-497B-AD0E-673EFDDCE533} = {70FA3413-2862-425B-B8A2-D5E1E68822D7}
{E8CB8FD9-BD72-42CB-8EFF-D23BF6334061} = {A91452D4-A0C7-4D08-9440-7202D7A43744}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AF7F16DE-C09B-4D43-83B7-9D081DD293A1}
Expand Down
2 changes: 2 additions & 0 deletions SqrlForNet/Chaos.NaCl/CryptoBytes.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;

namespace SqrlForNet.Chaos.NaCl
{
[ExcludeFromCodeCoverage]
public static class CryptoBytes
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions SqrlForNet/Chaos.NaCl/Ed25519.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System;
using System.Diagnostics.CodeAnalysis;
using SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10;

namespace SqrlForNet.Chaos.NaCl
{
[ExcludeFromCodeCoverage]
public static class Ed25519
{
/// <summary>
Expand Down
5 changes: 4 additions & 1 deletion SqrlForNet/Chaos.NaCl/Internal/Array16.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
namespace SqrlForNet.Chaos.NaCl.Internal
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal
{
// Array16<UInt32> Salsa20 state
// Array16<UInt64> SHA-512 block
[ExcludeFromCodeCoverage]
internal struct Array16<T>
{
public T x0;
Expand Down
5 changes: 4 additions & 1 deletion SqrlForNet/Chaos.NaCl/Internal/Array8.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
namespace SqrlForNet.Chaos.NaCl.Internal
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal
{
// Array8<UInt32> Poly1305 key
// Array8<UInt64> SHA-512 state/output
[ExcludeFromCodeCoverage]
internal struct Array8<T>
{
public T x0;
Expand Down
5 changes: 4 additions & 1 deletion SqrlForNet/Chaos.NaCl/Internal/ByteIntegerConverter.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
namespace SqrlForNet.Chaos.NaCl.Internal
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal
{
// Loops? Arrays? Never heard of that stuff
// Library avoids unnecessary heap allocations and unsafe code
// so this ugly code becomes necessary :(
[ExcludeFromCodeCoverage]
internal static class ByteIntegerConverter
{
public static ulong LoadBigEndian64(byte[] buf, int offset)
Expand Down
5 changes: 4 additions & 1 deletion SqrlForNet/Chaos.NaCl/Internal/Ed25519Ref10/FieldElement.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
{
[ExcludeFromCodeCoverage]
internal struct FieldElement
{
internal int x0, x1, x2, x3, x4, x5, x6, x7, x8, x9;
Expand Down
5 changes: 4 additions & 1 deletion SqrlForNet/Chaos.NaCl/Internal/Ed25519Ref10/GroupElement.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
{
/*
ge means group element.
Expand Down Expand Up @@ -37,6 +39,7 @@ internal struct GroupElementP1P1
public FieldElement T;
} ;

[ExcludeFromCodeCoverage]
internal struct GroupElementPreComp
{
public FieldElement yplusx;
Expand Down
5 changes: 4 additions & 1 deletion SqrlForNet/Chaos.NaCl/Internal/Ed25519Ref10/base.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
{
[ExcludeFromCodeCoverage]
internal static partial class LookupTables
{
/* base[i][j] = (j+1)*256^i*B */
Expand Down
7 changes: 5 additions & 2 deletions SqrlForNet/Chaos.NaCl/Internal/Ed25519Ref10/base2.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
{
internal static partial class LookupTables

internal static partial class LookupTables
{
internal static readonly GroupElementPreComp[] Base2 = new GroupElementPreComp[]{
new GroupElementPreComp(
Expand Down
4 changes: 3 additions & 1 deletion SqrlForNet/Chaos.NaCl/Internal/Ed25519Ref10/d.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
{
internal static partial class LookupTables
{
Expand Down
5 changes: 4 additions & 1 deletion SqrlForNet/Chaos.NaCl/Internal/Ed25519Ref10/fe_0.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
{
[ExcludeFromCodeCoverage]
internal static partial class FieldOperations
{
public static void fe_0(out FieldElement h)
Expand Down
5 changes: 4 additions & 1 deletion SqrlForNet/Chaos.NaCl/Internal/Ed25519Ref10/ge_tobytes.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
{
[ExcludeFromCodeCoverage]
internal static partial class GroupOperations
{
public static void ge_tobytes(byte[] s, int offset, ref GroupElementP2 h)
Expand Down
5 changes: 4 additions & 1 deletion SqrlForNet/Chaos.NaCl/Internal/Ed25519Ref10/sc_reduce.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
{
[ExcludeFromCodeCoverage]
internal static partial class ScalarOperations
{
/*
Expand Down
5 changes: 4 additions & 1 deletion SqrlForNet/Chaos.NaCl/Internal/Ed25519Ref10/scalarmult.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
{
[ExcludeFromCodeCoverage]
public static class MontgomeryOperations
{
public static void scalarmult(
Expand Down
2 changes: 2 additions & 0 deletions SqrlForNet/Chaos.NaCl/Internal/Ed25519Ref10/sign.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal.Ed25519Ref10
{
[ExcludeFromCodeCoverage]
internal static partial class Ed25519Operations
{
public static void crypto_sign(
Expand Down
5 changes: 4 additions & 1 deletion SqrlForNet/Chaos.NaCl/Internal/Sha512Internal.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace SqrlForNet.Chaos.NaCl.Internal
using System.Diagnostics.CodeAnalysis;

namespace SqrlForNet.Chaos.NaCl.Internal
{
[ExcludeFromCodeCoverage]
internal static class Sha512Internal
{
private static readonly ulong[] K = new ulong[]
Expand Down
2 changes: 2 additions & 0 deletions SqrlForNet/Chaos.NaCl/Sha512.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System;
using System.Diagnostics.CodeAnalysis;
using SqrlForNet.Chaos.NaCl.Internal;

namespace SqrlForNet.Chaos.NaCl
{
[ExcludeFromCodeCoverage]
public class Sha512
{
private Array8<ulong> _state;
Expand Down
10 changes: 10 additions & 0 deletions SqrlForNet/EccLevel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace SqrlForNet
{
public enum EccLevel
{
Low,
Medium,
Quartile,
High
}
}
8 changes: 5 additions & 3 deletions SqrlForNet/OtherAuthenticationPath.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
namespace SqrlForNet
using Microsoft.AspNetCore.Http;

namespace SqrlForNet
{
public class OtherAuthenticationPath
{
/// <summary>
/// The path to allow SQRL requests over
/// </summary>
public string Path;
public PathString Path;

/// <summary>
/// Is this path to be authenticated separately with other paths (a new user id is created for each path this is true for)
Expand All @@ -15,7 +17,7 @@ public class OtherAuthenticationPath
/// <summary>
/// The path that is used to redirect to for this path
/// </summary>
public string RedirectToPath;
public PathString RedirectToPath;

}
}
8 changes: 3 additions & 5 deletions SqrlForNet/SqrlAuthenticationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ public override Task<bool> ShouldHandleRequestAsync()
Logger.LogTrace("Started checking if request is handled");
if (Options.EnableHelpers &&
(
(
Options.HelpersPaths != null &&
Options.HelpersPaths.Any(x => Request.Path.StartsWithSegments(new PathString(x)))
) ||
Options.HelpersPaths == null))
Options.HelpersPaths != null &&
Options.HelpersPaths.Any(x => Request.Path.StartsWithSegments(new PathString(x)))
))
{
Logger.LogInformation("Helpers are enabled");
CommandWorker.Request = Request;
Expand Down
Loading

0 comments on commit dd39db5

Please sign in to comment.