Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Refactored validators.
- Refactored database entities & `PortalDb`.
- Upgraded Identity NuGet packages.
- Refactored Web layer.

### Fixed

Expand Down
18 changes: 2 additions & 16 deletions backend/src/Logitar.Portal.Web/Extensions/HttpContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static Uri BuildLocation(this HttpContext context, string path, IEnumerab
return builder.BuildUri();
}

public static IEnumerable<CustomAttribute> GetSessionCustomAttributes(this HttpContext context)
public static IReadOnlyCollection<CustomAttribute> GetSessionCustomAttributes(this HttpContext context)
{
List<CustomAttribute> customAttributes = new(capacity: 2)
{
Expand All @@ -57,7 +57,7 @@ public static IEnumerable<CustomAttribute> GetSessionCustomAttributes(this HttpC
customAttributes.Add(new("IpAddress", ipAddress));
}

return customAttributes;
return customAttributes.AsReadOnly();
}
public static string GetAdditionalInformation(this HttpContext context)
{
Expand Down Expand Up @@ -143,18 +143,4 @@ public static void SignOut(this HttpContext context)

context.Response.Cookies.Delete(Cookies.RefreshToken);
}

public static void SetResponse(this HttpContext context, int statusCode)
{
context.Response.StatusCode = statusCode;
}
public static async Task SetResponseAsync<T>(this HttpContext context, int statusCode, T? value = default, CancellationToken cancellationToken = default)
{
context.SetResponse(statusCode);

if (value != null)
{
await context.Response.WriteAsJsonAsync(value, cancellationToken);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace Logitar.Portal.Authentication;

internal class ApiKeyAuthenticationOptions : AuthenticationSchemeOptions;

internal class ApiKeyAuthenticationHandler : AuthenticationHandler<ApiKeyAuthenticationOptions>
{
private readonly IActivityPipeline _activityPipeline;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Logitar.Portal.Authentication;

internal class BasicAuthenticationOptions : AuthenticationSchemeOptions;

internal class BasicAuthenticationHandler : AuthenticationHandler<BasicAuthenticationOptions>
{
private readonly IActivityPipeline _activityPipeline;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Logitar.Portal.Authentication;

internal class BearerAuthenticationOptions : AuthenticationSchemeOptions;

internal class BearerAuthenticationHandler : AuthenticationHandler<BearerAuthenticationOptions>
{
private readonly IActivityPipeline _activityPipeline;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

namespace Logitar.Portal.Authentication;

internal class SessionAuthenticationOptions : AuthenticationSchemeOptions;

internal class SessionAuthenticationHandler : AuthenticationHandler<SessionAuthenticationOptions>
{
private readonly IActivityPipeline _activityPipeline;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

namespace Logitar.Portal.Authorization;

internal class PortalActorAuthorizationRequirement : IAuthorizationRequirement;

internal class PortalActorAuthorizationHandler : AuthorizationHandler<PortalActorAuthorizationRequirement>
{
private readonly IHttpContextAccessor _httpContextAccessor;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Logitar.Portal.Authorization;

internal class PortalUserAuthorizationRequirement : IAuthorizationRequirement;

internal class PortalUserAuthorizationHandler : AuthorizationHandler<PortalUserAuthorizationRequirement>
{
private readonly IHttpContextAccessor _httpContextAccessor;
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion backend/src/Logitar.Portal/Controllers/IndexController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ namespace Logitar.Portal.Controllers;
public class IndexController : ControllerBase
{
[HttpGet]
public ActionResult<ApiVersion> Get() => Ok(new ApiVersion());
public ActionResult<ApiVersion> Get() => Ok(ApiVersion.Current);
}
4 changes: 3 additions & 1 deletion backend/src/Logitar.Portal/Models/ApiVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ namespace Logitar.Portal.Models;

public record ApiVersion
{
public static ApiVersion Current => new(Api.Title, Api.Version);

public string Title { get; set; }
public string Version { get; set; }

public ApiVersion() : this(Api.Title, Api.Version)
public ApiVersion() : this(string.Empty, string.Empty)
{
}

Expand Down
Loading