-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34f25ad
commit c56d036
Showing
19 changed files
with
1,503 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace LLMServiceHub.Common | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public static class AppConsts | ||
{ | ||
/// <summary> | ||
/// The default authentication scheme | ||
/// </summary> | ||
public const string DefaultAuthScheme = "LLMService.Auth"; | ||
/// <summary> | ||
/// The authentication cookie name | ||
/// </summary> | ||
public const string AuthCookieName = "LLMService.Auth"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace LLMServiceHub.Common | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
public class BuildInUser | ||
{ | ||
/// <summary> | ||
/// Gets or sets the name of the user. | ||
/// </summary> | ||
/// <value> | ||
/// The name of the user. | ||
/// </value> | ||
public string UserName { get; set; } | ||
/// <summary> | ||
/// Gets or sets the password. | ||
/// </summary> | ||
/// <value> | ||
/// The password. | ||
/// </value> | ||
public string Password { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@if(User.Identity.IsAuthenticated){ | ||
|
||
<div class="nav-item"> | ||
<a href="javascript:void(0)" class="nav-link d-flex lh-1 text-reset p-0"> | ||
<span class="avatar avatar-sm"></span> | ||
<div class="d-none d-xl-block ps-2"> | ||
<div>我</div> | ||
<div class="mt-1 small text-secondary">测试用户</div> | ||
</div> | ||
</a> | ||
</div> | ||
<div class="nav-item"> | ||
<!-- Download SVG icon from http://tabler-icons.io/i/dots-vertical --> | ||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path><path d="M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path><path d="M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path></svg> | ||
|
||
</div> | ||
<div class="nav-item"> | ||
<a asp-page="SignOut" class="nav-link d-flex lh-1 text-reset p-0"> | ||
退出登录 | ||
</a> | ||
</div> | ||
} | ||
else{ | ||
<div class="nav-item"> | ||
<span>尚未登录</span> | ||
</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@page | ||
@model LLMServiceHub.Pages.SignOutModel | ||
@{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using LLMServiceHub.Common; | ||
using Microsoft.AspNetCore.Authentication; | ||
using Microsoft.AspNetCore.Authentication.Cookies; | ||
using Microsoft.AspNetCore.Identity; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
||
namespace LLMServiceHub.Pages | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <seealso cref="Microsoft.AspNetCore.Mvc.RazorPages.PageModel" /> | ||
public class SignOutModel : PageModel | ||
{ | ||
/// <summary> | ||
/// Called when [get]. | ||
/// </summary> | ||
public async Task<IActionResult> OnGetAsync(string returnUrl = null) | ||
{ | ||
returnUrl ??= Url.Content("~/"); | ||
// Clear the existing external cookie to ensure a clean login process | ||
//await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme); | ||
await HttpContext.SignOutAsync(AppConsts.DefaultAuthScheme); | ||
|
||
return LocalRedirect(returnUrl); | ||
} | ||
} | ||
} |
Oops, something went wrong.