Skip to content

Commit

Permalink
Refactor little bit
Browse files Browse the repository at this point in the history
  • Loading branch information
oveldman committed Feb 3, 2024
1 parent 8ba6d5c commit 573b404
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public static void AddIdentityEndpoints(this WebApplication app)

account.MapPost("/JwtLogin",
([FromBody] JwtLoginRequest request, [FromServices] PostJwtLoginUseCase useCase, HttpContext context) =>
useCase.PostJwtLogin(request, context.Request.GetBaseUrl()))
useCase.PostJwtLogin(request, context.Request.GetOriginUrl()))
.WithName("JwtLogin")
.WithOpenApi()
.AllowAnonymous();

account.MapPost("/JwtRefresh",
([FromBody] JwtRefreshRequest request, [FromServices] PostJwtRefreshUseCase useCase, HttpContext context) =>
useCase.PostJwtRefresh(request, context.Request.GetBaseUrl()))
useCase.PostJwtRefresh(request, context.Request.GetOriginUrl()))
.WithName("JwtRefresh")
.WithOpenApi()
.AllowAnonymous();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace MadWorld.Backend.Identity.Extensions;

public static class RequestExtensions
{
public static string GetBaseUrl(this HttpRequest request)
public static string GetOriginUrl(this HttpRequest request)
{
request.Headers.TryGetValue("Origin", out var originValues);
var url = originValues.Count != 0 ? originValues[0]! : string.Empty;
Expand Down
28 changes: 19 additions & 9 deletions MadWorld/MadWorld.Frontend.Admin/Pages/UserManagement/User.razor
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,25 @@
<div class="card">
<h5 class="card-header">Sessions</h5>
<div class="card-body">
<RadzenDataGrid AllowFiltering="false" AllowSorting="false" AllowPaging="false"
ShowPagingSummary="true" Data="@_user.RefreshTokens" TItem="RefreshTokenDetails">
<Columns>
<RadzenDataGridColumn TItem="RefreshTokenDetails" Property="Audience" Title="Audience"/>
<RadzenDataGridColumn TItem="RefreshTokenDetails" Property="Expires" Title="Expires"/>
</Columns>
</RadzenDataGrid>
<div class="mb-3">
<button type="button" class="btn btn-danger" @onclick="DeleteSessions">Delete sessions</button>
<div class="row">
<div class="col">
<div class="mb-3">
<RadzenDataGrid AllowFiltering="false" AllowSorting="false" AllowPaging="false"
ShowPagingSummary="true" Data="@_user.RefreshTokens" TItem="RefreshTokenDetails">
<Columns>
<RadzenDataGridColumn TItem="RefreshTokenDetails" Property="Audience" Title="Audience"/>
<RadzenDataGridColumn TItem="RefreshTokenDetails" Property="Expires" Title="Expires"/>
</Columns>
</RadzenDataGrid>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="mb-3">
<button type="button" class="btn btn-danger" @onclick="DeleteSessions">Delete sessions</button>
</div>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit 573b404

Please sign in to comment.