diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml index db9f1f100a..c61632e453 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml @@ -1,34 +1,103 @@ @page +@using Microsoft.AspNetCore.Mvc.Localization @using MyCompanyName.MyProjectName.Pages +@using MyCompanyName.MyProjectName.Localization @using Volo.Abp.Users +@using Volo.Abp.AspNetCore.Mvc.UI.Theming +@using Volo.Abp.Ui.Branding @model IndexModel +@inject IHtmlLocalizer L @inject ICurrentUser CurrentUser -@if (CurrentUser.IsAuthenticated) -{ -
+@inject IBrandingProvider BrandingProvider +@inject ITheme Theme + +@{ + Layout = Theme.GetEmptyLayout(); +} + +
+
- - - Logout - - -

@CurrentUser.UserName

-
@CurrentUser.Email
-
- Roles: @CurrentUser.Roles.JoinAsString(", ") -
- Claims:
- @Html.Raw(CurrentUser.GetAllClaims().Select(c => $"{c.Type}={c.Value}").JoinAsString("
")) + + -} + + + + +
+
+
+ +
+
+ @if (CurrentUser.IsAuthenticated) + { + + @L["Welcome"] @CurrentUser.UserName + + @CurrentUser.Email + + } + else + { + @L["Login"] + } +
+
-@if (!CurrentUser.IsAuthenticated) -{ -
-

- Login +
+ + + + @foreach (var client in Model.Clients.Where(x => x.RedirectUris.Count > 0)) + { + + + + + @if (!client.LogoUri.IsNullOrEmpty()) + { +
+ +
+ } + +

@client.ClientName

+ @{ + var redirectUri = new Uri(@client.RedirectUris.First().RedirectUri); + var url = @redirectUri.AbsoluteUri.RemovePostFix(redirectUri.AbsolutePath); + } + @url +
+ Visit +
+
+
+
+ } + +
+
+ + + + +
+ +
-} +
diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml.cs index e8230ee00c..df43e3a798 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Pages/Index.cshtml.cs @@ -1,10 +1,25 @@ using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using IdentityServer4.Stores; +using Volo.Abp.IdentityServer.Clients; +using System.Threading.Tasks; +using System.Collections.Generic; namespace MyCompanyName.MyProjectName.Pages; public class IndexModel : AbpPageModel { - public void OnGet() + public List Clients { get; protected set; } + + // TODO: Consider using IClientStore here. + protected IClientRepository ClientRepository { get; } + + public IndexModel(IClientRepository clientRepository) + { + this.ClientRepository = clientRepository; + } + + public async Task OnGetAsync() { + Clients = await ClientRepository.GetListAsync(includeDetails: true); } -} +} \ No newline at end of file