Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@inherits UAuthHubLayoutComponentBase
@inherits UAuthHubLayoutBase
@inject IUAuthClient UAuthClient
@inject ISnackbar Snackbar
@inject NavigationManager Nav

@if (!IsHubAuthorized)
@if (!IsHubActive)
{
<MudAppBar Class="uauth-blur" Color="Color.Transparent" Dense="true" Elevation="0">
<UAuthLogo />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void HandleSignInClick()

if (uri.AbsolutePath.EndsWith("/login", StringComparison.OrdinalIgnoreCase))
{
Nav.NavigateTo("/login?focus=1", replace: true, forceLoad: true);
Nav.NavigateTo("/login?uauth_focus=1", replace: true, forceLoad: true);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using CodeBeam.UltimateAuth.Client.Blazor;
using CodeBeam.UltimateAuth.Client.Runtime;
using CodeBeam.UltimateAuth.Core.Contracts;
using CodeBeam.UltimateAuth.Core.Defaults;
using CodeBeam.UltimateAuth.Core.Domain;
using CodeBeam.UltimateAuth.Server.Stores;
using MudBlazor;
Expand Down Expand Up @@ -56,7 +57,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)

if (HubSessionId.TryParse(HubKey, out var hubSessionId))
{
await ReloadState();
await ReloadStateAsync();
}

await _loginForm.ReloadAsync();
Expand Down Expand Up @@ -143,10 +144,10 @@ private async Task<string> ResolveReturnUrlAsync()
var uri = Nav.ToAbsoluteUri(Nav.Uri);
var query = Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(uri.Query);

if (query.TryGetValue("return_url", out var ru) && !string.IsNullOrWhiteSpace(ru))
if (query.TryGetValue(UAuthConstants.Query.ReturnUrl, out var ru) && !string.IsNullOrWhiteSpace(ru))
return ru!;

if (query.TryGetValue("hub", out var hubKey) && !string.IsNullOrWhiteSpace(hubKey))
if (query.TryGetValue(UAuthConstants.Query.Hub, out var hubKey) && !string.IsNullOrWhiteSpace(hubKey))
{
var artifact = await AuthStore.GetAsync(new AuthArtifactKey(hubKey!));
if (artifact is HubFlowArtifact flow && !string.IsNullOrWhiteSpace(flow.ReturnUrl))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@inherits UAuthHubLayoutComponentBase
@inherits UAuthHubLayoutBase
@inject IUAuthClient UAuthClient
@inject ISnackbar Snackbar
@inject NavigationManager Nav

@if (!IsHubAuthorized)
@if (!IsHubActive)
{
<MudAppBar Class="uauth-blur" Color="Color.Transparent" Dense="true" Elevation="0">
<UAuthLogo />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void HandleSignInClick()

if (uri.AbsolutePath.EndsWith("/login", StringComparison.OrdinalIgnoreCase))
{
Nav.NavigateTo("/login?focus=1", replace: true, forceLoad: true);
Nav.NavigateTo("/login?uauth_focus=1", replace: true, forceLoad: true);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using CodeBeam.UltimateAuth.Client.Blazor;
using CodeBeam.UltimateAuth.Client.Runtime;
using CodeBeam.UltimateAuth.Core.Contracts;
using CodeBeam.UltimateAuth.Core.Defaults;
using CodeBeam.UltimateAuth.Core.Domain;
using CodeBeam.UltimateAuth.Server.Stores;
using MudBlazor;
Expand Down Expand Up @@ -56,7 +57,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)

if (HubSessionId.TryParse(HubKey, out var hubSessionId))
{
await ReloadState();
await ReloadStateAsync();
}

await _loginForm.ReloadAsync();
Expand Down Expand Up @@ -143,10 +144,10 @@ private async Task<string> ResolveReturnUrlAsync()
var uri = Nav.ToAbsoluteUri(Nav.Uri);
var query = Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(uri.Query);

if (query.TryGetValue("return_url", out var ru) && !string.IsNullOrWhiteSpace(ru))
if (query.TryGetValue(UAuthConstants.Query.ReturnUrl, out var ru) && !string.IsNullOrWhiteSpace(ru))
return ru!;

if (query.TryGetValue("hub", out var hubKey) && !string.IsNullOrWhiteSpace(hubKey))
if (query.TryGetValue(UAuthConstants.Query.Hub, out var hubKey) && !string.IsNullOrWhiteSpace(hubKey))
{
var artifact = await AuthStore.GetAsync(new AuthArtifactKey(hubKey!));
if (artifact is HubFlowArtifact flow && !string.IsNullOrWhiteSpace(flow.ReturnUrl))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/authorized-test"
@attribute [UAuthAuthorize]
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

<MudPage Class="d-flex align-center justify-center" FullScreen="FullScreen.FullWithoutAppbar" Column="1" Row="1">
<MudPaper Class="pa-8" Style="max-width: 520px; width: 100%;" Elevation="0" Outlined="true">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/home"
@attribute [UAuthAuthorize]
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@inject IUAuthClient UAuthClient
@inject UAuthClientDiagnostics Diagnostics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore.Components.Pages;

public partial class Home : UAuthFlowPageBase
public partial class Home : UAuthPageBase
{
private string _selectedAuthState = "UAuthState";
private ClaimsPrincipal? _aspNetCoreState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/login"
@attribute [UAuthLoginPage]
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@implements IDisposable
@inject IUAuthClient UAuthClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore.Components.Pages;

public partial class Login : UAuthFlowPageBase
public partial class Login : UAuthPageBase
{
private string? _username;
private string? _password;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page "/register"
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@implements IDisposable
@inject IUAuthClient UAuthClient
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page "/reset"
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@inject IUAuthClient UAuthClient
@inject ISnackbar Snackbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void HandleSignInClick()

if (uri.AbsolutePath.EndsWith("/login", StringComparison.OrdinalIgnoreCase))
{
Nav.NavigateTo("/login?focus=1", replace: true, forceLoad: true);
Nav.NavigateTo("/login?uauth_focus=1", replace: true, forceLoad: true);
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@page "/authorized-test"
@using CodeBeam.UltimateAuth.Core.Defaults
@attribute [UAuthAuthorize]
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

<MudPage Class="d-flex align-center justify-center" FullScreen="FullScreen.FullWithoutAppbar" Column="1" Row="1">
<MudPaper Class="pa-8" Style="max-width: 520px; width: 100%;" Elevation="0" Outlined="true">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/home"
@attribute [UAuthAuthorize]
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@inject IUAuthClient UAuthClient
@inject UAuthClientDiagnostics Diagnostics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace CodeBeam.UltimateAuth.Sample.BlazorServer.Components.Pages;

public partial class Home : UAuthFlowPageBase
public partial class Home : UAuthPageBase
{
private string _selectedAuthState = "UAuthState";
private ClaimsPrincipal? _aspNetCoreState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/login"
@attribute [UAuthLoginPage]
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@implements IDisposable
@inject IUAuthClient UAuthClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace CodeBeam.UltimateAuth.Sample.BlazorServer.Components.Pages;

public partial class Login : UAuthFlowPageBase
public partial class Login : UAuthPageBase
{
private string? _username;
private string? _password;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page "/register"
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@implements IDisposable
@inject IUAuthClient UAuthClient
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page "/reset"
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@inject IUAuthClient UAuthClient
@inject ISnackbar Snackbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void HandleSignInClick()

if (uri.AbsolutePath.EndsWith("/login", StringComparison.OrdinalIgnoreCase))
{
Nav.NavigateTo("/login?focus=1", replace: true, forceLoad: true);
Nav.NavigateTo("/login?uauth_focus=1", replace: true, forceLoad: true);
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/authorized-test"
@attribute [UAuthAuthorize]
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

<MudPage Class="d-flex align-center justify-center" FullScreen="FullScreen.FullWithoutAppbar" Column="1" Row="1">
<MudPaper Class="pa-8" Style="max-width: 520px; width: 100%;" Elevation="0" Outlined="true">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/home"
@attribute [UAuthAuthorize]
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@inject IUAuthClient UAuthClient
@inject UAuthClientDiagnostics Diagnostics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm.Pages;

public partial class Home : UAuthFlowPageBase
public partial class Home : UAuthPageBase
{
private string _selectedAuthState = "UAuthState";
private ClaimsPrincipal? _aspNetCoreState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/login"
@attribute [UAuthLoginPage]
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@implements IDisposable
@inject IUAuthClient UAuthClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm.Pages;

public partial class Login : UAuthFlowPageBase
public partial class Login : UAuthPageBase
{
private string? _username;
private string? _password;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page "/register"
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@implements IDisposable
@inject IUAuthClient UAuthClient
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page "/reset"
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@inject IUAuthClient UAuthClient
@inject ISnackbar Snackbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private void HandleSignInClick()

if (uri.AbsolutePath.EndsWith("/login", StringComparison.OrdinalIgnoreCase))
{
Nav.NavigateTo("/login?focus=1", replace: true, forceLoad: true);
Nav.NavigateTo("/login?uauth_focus=1", replace: true, forceLoad: true);
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/authorized-test"
@attribute [UAuthAuthorize]
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

<MudPage Class="d-flex align-center justify-center" FullScreen="FullScreen.FullWithoutAppbar" Column="1" Row="1">
<MudPaper Class="pa-8" Style="max-width: 520px; width: 100%;" Elevation="0" Outlined="true">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/home"
@attribute [UAuthAuthorize]
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@inject IUAuthClient UAuthClient
@inject UAuthClientDiagnostics Diagnostics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace CodeBeam.UAuth.Sample.IntWasm.Client.Pages;

public partial class Home : UAuthFlowPageBase
public partial class Home : UAuthPageBase
{
private string _selectedAuthState = "UAuthState";
private ClaimsPrincipal? _aspNetCoreState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@page "/login"
@using CodeBeam.UltimateAuth.Client.Runtime
@attribute [UAuthLoginPage]
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@implements IDisposable
@inject IUAuthClient UAuthClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace CodeBeam.UAuth.Sample.IntWasm.Client.Pages;

public partial class Login : UAuthFlowPageBase
public partial class Login : UAuthPageBase
{
private string? _username;
private string? _password;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@page "/register"
@using CodeBeam.UltimateAuth.Client.Runtime
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@implements IDisposable
@inject IUAuthClient UAuthClient
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page "/reset"
@inherits UAuthFlowPageBase
@inherits UAuthPageBase

@inject IUAuthClient UAuthClient
@inject ISnackbar Snackbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ public sealed record PkceCompleteRequest
[JsonPropertyName("code_verifier")]
public required string CodeVerifier { get; init; }


public required string Identifier { get; init; }

public required string Secret { get; init; }

[JsonPropertyName("return_url")]
Expand Down
7 changes: 5 additions & 2 deletions src/CodeBeam.UltimateAuth.Core/Defaults/UAuthConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ public static class Form

public static class Query
{
public const string ReturnUrl = "return_url";
public const string Hub = "hub";
public const string Payload = "uauth";
public const string Focus = "uauth_focus";
public const string ReturnUrl = "uauth_return_url";
public const string Identifier = "uauth_identifier";
public const string Hub = "uauth_hub";
}

public static class Headers
Expand Down
1 change: 1 addition & 0 deletions src/CodeBeam.UltimateAuth.Server/AssemblyVisibility.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("CodeBeam.UltimateAuth.Tests.Unit")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
Loading
Loading