Added admin page navigation
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using HopFrame.Core.Services;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace HopFrame.Core.Config;
|
||||
|
||||
public class HopFrameConfig {
|
||||
public List<DbContextConfig> Contexts { get; init; } = new();
|
||||
public bool DisplayUserInfo { get; set; } = true;
|
||||
public Type? AuthHandler { get; set; }
|
||||
public string? BasePolicy { get; set; }
|
||||
public string? LoginPageRewrite { get; set; }
|
||||
}
|
||||
|
||||
public class HopFrameConfigurator(HopFrameConfig config) {
|
||||
@@ -24,4 +28,19 @@ public class HopFrameConfigurator(HopFrameConfig config) {
|
||||
config.DisplayUserInfo = display;
|
||||
return this;
|
||||
}
|
||||
|
||||
public HopFrameConfigurator SetAuthHandler<TAuthHandler>() where TAuthHandler : IHopFrameAuthHandler {
|
||||
config.AuthHandler = typeof(TAuthHandler);
|
||||
return this;
|
||||
}
|
||||
|
||||
public HopFrameConfigurator SetBasePolicy(string basePolicy) {
|
||||
config.BasePolicy = basePolicy;
|
||||
return this;
|
||||
}
|
||||
|
||||
public HopFrameConfigurator SetLoginPage(string url) {
|
||||
config.LoginPageRewrite = url;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
6
src/HopFrame.Core/Services/IHopFrameAuthHandler.cs
Normal file
6
src/HopFrame.Core/Services/IHopFrameAuthHandler.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace HopFrame.Core.Services;
|
||||
|
||||
public interface IHopFrameAuthHandler {
|
||||
public Task<bool> IsAuthenticatedAsync(string? policy);
|
||||
public Task<string> GetCurrentUserDisplayNameAsync();
|
||||
}
|
||||
Reference in New Issue
Block a user