Publish curated Knowledge Hub source from 2ed833f290b439a7bc91e5fd19b042c269e3bee9
This commit is contained in:
1 parent
10f2edcd29
commit
59f15b2d08
218 files changed
+23995
-1849
No files matched your search
@@ -2,12 +2,12 @@ using ItWorx.KnowledgeHub.Api.Security;
|
||||
using ItWorx.KnowledgeHub.Application.Identity;
|
||||
using ItWorx.KnowledgeHub.Application.Identity.UseCases;
|
||||
using ItWorx.KnowledgeHub.Application.Ingestion;
|
||||
using ItWorx.KnowledgeHub.Application.Platform;
|
||||
using ItWorx.KnowledgeHub.Contracts.Auth;
|
||||
using ItWorx.KnowledgeHub.Contracts.Errors;
|
||||
using Microsoft.AspNetCore.Antiforgery;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ItWorx.KnowledgeHub.Api.Endpoints;
|
||||
|
||||
@@ -40,18 +40,19 @@ public static class AuthEndpoints
|
||||
|
||||
private static async Task<Ok<SessionResponse>> GetSessionAsync(
|
||||
GetSessionUseCase useCase,
|
||||
IOptions<IngestionProposalOptions> ingestionOptions,
|
||||
IPlatformSettingsReader platformSettings,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var session = await useCase.ExecuteAsync(cancellationToken);
|
||||
return TypedResults.Ok(ToSessionResponse(session, ingestionOptions.Value));
|
||||
var ingestion = (await platformSettings.GetEffectiveAsync(cancellationToken)).Values.IngestionProposals;
|
||||
return TypedResults.Ok(ToSessionResponse(session, ingestion));
|
||||
}
|
||||
|
||||
private static async Task<Results<Ok<SessionResponse>, ProblemHttpResult>> LoginAsync(
|
||||
[FromBody] LoginRequest request,
|
||||
LoginUseCase loginUseCase,
|
||||
GetSessionUseCase sessionUseCase,
|
||||
IOptions<IngestionProposalOptions> ingestionOptions,
|
||||
IPlatformSettingsReader platformSettings,
|
||||
HttpContext httpContext,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
@@ -65,7 +66,8 @@ public static class AuthEndpoints
|
||||
{
|
||||
case PasswordSignInStatus.Success:
|
||||
var session = await sessionUseCase.ExecuteAsync(cancellationToken);
|
||||
return TypedResults.Ok(ToSessionResponse(session, ingestionOptions.Value));
|
||||
var ingestion = (await platformSettings.GetEffectiveAsync(cancellationToken)).Values.IngestionProposals;
|
||||
return TypedResults.Ok(ToSessionResponse(session, ingestion));
|
||||
|
||||
case PasswordSignInStatus.LockedOut:
|
||||
return TypedResults.Problem(
|
||||
@@ -124,7 +126,7 @@ public static class AuthEndpoints
|
||||
};
|
||||
}
|
||||
|
||||
private static SessionResponse ToSessionResponse(SessionInfo session, IngestionProposalOptions ingestionOptions) => new(
|
||||
private static SessionResponse ToSessionResponse(SessionInfo session, ItWorx.KnowledgeHub.Domain.Platform.IngestionProposalPolicyValues ingestionOptions) => new(
|
||||
session.Authenticated,
|
||||
session.SetupRequired,
|
||||
session.UserId,
|
||||
|
||||
Reference in new issue
Block a user