Skip to content

Commit 9df4390

Browse files
Api Scope fields on Create/Update documented on UI.
1 parent edf8cd9 commit 9df4390

File tree

8 files changed

+66
-72
lines changed

8 files changed

+66
-72
lines changed

src/IdentityServer/Areas/HeliosAdminUI/Dictionnary/ApiScopes/ApiScopesInfo.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
using System.Collections.Generic;
1+
using IdentityServer4.Models;
2+
using System.Collections.Generic;
23

34
namespace IdentityServer.Areas.HeliosAdminUI.Dictionnary.ApiScopes
45
{
56
public static class ApiScopesInfo
67
{
78
public static Dictionary<string, string> Data = new Dictionary<string, string>
89
{
9-
{"ClientId","yop" }
10+
{nameof(ApiScope.Name),"The unique name of the API. This value is used for authentication with introspection and will be added to the audience of the outgoing access token." },
11+
{nameof(ApiScope.DisplayName),"This value can be used e.g. on the consent screen." },
12+
{nameof(ApiScope.Description),"This value can be used e.g. on the consent screen." },
13+
{nameof(ApiScope.Required)," Specifies whether the user can de-select the scope on the consent screen. Defaults to false."},
14+
{nameof(ApiScope.Emphasize),"Specifies whether the consent screen will emphasize this scope. Use this setting for sensitive or important scopes. Defaults to false." },
15+
{nameof(ApiScope.Enabled),"Indicates if this resource is enabled. Defaults to True." },
16+
{nameof(ApiScope.ShowInDiscoveryDocument),"Specifies whether this scope is shown in the discovery document. Defaults to True." },
17+
{nameof(ApiScope.UserClaims),"List of associated user claims that should be included when this resource is requested." },
18+
{nameof(ApiScope.Properties),"Gets or sets the custom properties for the resource." }
1019
};
1120

1221
}

src/IdentityServer/Areas/HeliosAdminUI/Models/ApiScopes/CreateApiScopeModel.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,32 @@ public class CreateApiScopeModel
99

1010
[Required]
1111
[MaxLength(250)]
12+
[Display(Name="Name")]
1213
public string Name { get; set; }
1314

1415
[Required]
1516
[MaxLength(250)]
17+
[Display(Name = "Display name")]
1618
public string DisplayName { get; set; }
1719

1820
[MaxLength(250)]
21+
[Display(Name ="Description")]
1922
public string Description { get; set; }
2023

2124
[Required]
25+
[Display(Name = "Required")]
2226
public bool Required { get; set; }
2327

28+
[Display(Name = "Emphasize")]
2429
public bool Emphasize { get; set; }
2530

2631
[Required]
27-
public bool Enabled { get; set; }
32+
[Display(Name = "Enabled")]
33+
public bool Enabled { get; set; } = true;
2834

2935
[Required]
3036
[Display(Name = "Show in Discovery Document")]
31-
public bool ShowInDiscoveryDocument { get; set; }
37+
public bool ShowInDiscoveryDocument { get; set; } = true;
3238
public List<ApiScopeClaim> UserClaims { get; set; }
3339
public List<ApiScopeProperty> Properties { get; set; }
3440
}

src/IdentityServer/Areas/HeliosAdminUI/Models/ApiScopes/UpdateApiScopeViewModel.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,27 @@ public class UpdateApiScopeViewModel
1010

1111
[Required]
1212
[MaxLength(250)]
13+
[Display(Name="Name")]
1314
public string Name { get; set; }
1415

1516
[Required]
1617
[MaxLength(250)]
18+
[Display(Name = "Display name")]
1719
public string DisplayName { get; set; }
1820

1921
[MaxLength(250)]
22+
[Display(Name = "Description")]
2023
public string Description { get; set; }
2124

2225
[Required]
26+
[Display(Name = "Required")]
2327
public bool Required { get; set; }
2428

29+
[Display(Name = "Emphasize")]
2530
public bool Emphasize { get; set; }
2631

2732
[Required]
33+
[Display(Name = "Enabled")]
2834
public bool Enabled { get; set; }
2935

3036
[Required]

src/IdentityServer/Areas/HeliosAdminUI/TagHelpers/FieldInfo.cs renamed to src/IdentityServer/Areas/HeliosAdminUI/TagHelpers/LabelInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private Dictionary<string, string> GetDictionnaryInfo(string containerName)
4141
{
4242
dictionary = ClientsInfo.Data;
4343
}
44-
else if(containerName.Contains("apiscopes"))
44+
else if(containerName.Contains("apiscope"))
4545
{
4646
dictionary = ApiScopesInfo.Data;
4747
}

src/IdentityServer/Areas/HeliosAdminUI/Views/ApiScopes/Create.cshtml

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@model IdentityServer.Areas.HeliosAdminUI.Models.ApiScopes.CreateApiScopeModel;
1+
@model CreateApiScopeModel;
22

33
@{
44
if (ViewBag.isSuccess == true)
@@ -21,15 +21,15 @@
2121
<form method="post" asp-controller="ApiScopes" asp-action="Create">
2222
<div class="row">
2323
<div class="form-group col-6">
24-
<label asp-for="Name" class="col-form-label"></label>
24+
<LabelInfo asp-for="Name"></LabelInfo>
2525
<div>
2626
<input asp-for="Name" class="form-control" />
2727
</div>
2828
<span class="text-danger" asp-validation-for="Name"></span>
2929
</div>
3030

3131
<div class="form-group col-6">
32-
<label asp-for="DisplayName" class="col-form-label"></label>
32+
<LabelInfo asp-for="DisplayName"></LabelInfo>
3333
<div>
3434
<input asp-for="DisplayName" class="form-control" />
3535
</div>
@@ -38,45 +38,30 @@
3838
</div>
3939
<div class="row">
4040
<div class="form-group col-12">
41-
<label asp-for="Description" class="col-form-label"></label>
41+
<LabelInfo asp-for="Description"></LabelInfo>
4242
<div>
4343
<textarea cols="20" rows="10" asp-for="Description" class="form-control"></textarea>
4444
</div>
4545
</div>
4646
</div>
4747
<div class="form-group row">
48-
<div class="col-3">
49-
<div class="form-control-plaintext">
50-
<div class="custom-control custom-checkbox">
51-
<input asp-for="Emphasize" type="checkbox" class="custom-control-input" />
52-
<label asp-for="Emphasize" class="custom-control-label"></label>
53-
</div>
54-
</div>
48+
<div class="col-2">
49+
<LabelInfo asp-for="Emphasize"></LabelInfo>
50+
<input asp-for="Emphasize" type="checkbox" />
5551
</div>
56-
<div class="col-3">
57-
<div class="form-control-plaintext">
58-
<div class="custom-control custom-checkbox">
59-
<input asp-for="Required" type="checkbox" class="custom-control-input" />
60-
<label asp-for="Required" class="custom-control-label"></label>
61-
</div>
62-
</div>
52+
<div class="col-2">
53+
<LabelInfo asp-for="Required"></LabelInfo>
54+
<input asp-for="Required" type="checkbox"/>
6355
</div>
6456

65-
<div class="col-3">
66-
<div class="form-control-plaintext">
67-
<div class="custom-control custom-checkbox">
68-
<input asp-for="Enabled" type="checkbox" class="custom-control-input" />
69-
<label asp-for="Enabled" class="custom-control-label"></label>
70-
</div>
71-
</div>
57+
<div class="col-2">
58+
<LabelInfo asp-for="Enabled"></LabelInfo>
59+
<input asp-for="Enabled" type="checkbox"/>
7260
</div>
73-
<div class="col-lg-3">
74-
<div class="form-control-plaintext">
75-
<div class="custom-control custom-checkbox">
76-
<input asp-for="ShowInDiscoveryDocument" type="checkbox" class="custom-control-input" />
77-
<label asp-for="ShowInDiscoveryDocument" class="custom-control-label"></label>
78-
</div>
79-
</div>
61+
<div class="col-lg-4">
62+
<LabelInfo asp-for="ShowInDiscoveryDocument"></LabelInfo>
63+
<input asp-for="ShowInDiscoveryDocument" type="checkbox" />
64+
8065
</div>
8166
</div>
8267
<hr />

src/IdentityServer/Areas/HeliosAdminUI/Views/ApiScopes/Edit.cshtml

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
<input type="hidden" asp-for="Id" />
2323
<div class="row">
2424
<div class="form-group col-6">
25-
<label asp-for="Name" class="col-form-label"></label>
25+
<LabelInfo asp-for="Name"></LabelInfo>
2626
<div>
2727
<input asp-for="Name" class="form-control" />
2828
</div>
2929
<span class="text-danger" asp-validation-for="Name"></span>
3030
</div>
3131

3232
<div class="form-group col-6">
33-
<label asp-for="DisplayName" class="col-form-label"></label>
33+
<LabelInfo asp-for="DisplayName"></LabelInfo>
3434
<div>
3535
<input asp-for="DisplayName" class="form-control" />
3636
</div>
@@ -39,45 +39,30 @@
3939
</div>
4040
<div class="row">
4141
<div class="form-group col-12">
42-
<label asp-for="Description" class="col-form-label"></label>
42+
<LabelInfo asp-for="Description"></LabelInfo>
4343
<div>
4444
<textarea cols="20" rows="10" asp-for="Description" class="form-control"></textarea>
4545
</div>
4646
</div>
4747
</div>
4848
<div class="form-group row">
49-
<div class="col-3">
50-
<div class="form-control-plaintext">
51-
<div class="custom-control custom-checkbox">
52-
<input asp-for="Emphasize" type="checkbox" class="custom-control-input" />
53-
<label asp-for="Emphasize" class="custom-control-label"></label>
54-
</div>
55-
</div>
49+
<div class="col-2">
50+
<LabelInfo asp-for="Emphasize"></LabelInfo>
51+
<input asp-for="Emphasize" type="checkbox" />
5652
</div>
57-
<div class="col-3">
58-
<div class="form-control-plaintext">
59-
<div class="custom-control custom-checkbox">
60-
<input asp-for="Required" type="checkbox" class="custom-control-input" />
61-
<label asp-for="Required" class="custom-control-label"></label>
62-
</div>
63-
</div>
53+
<div class="col-2">
54+
<LabelInfo asp-for="Required"></LabelInfo>
55+
<input asp-for="Required" type="checkbox" />
6456
</div>
6557

66-
<div class="col-3">
67-
<div class="form-control-plaintext">
68-
<div class="custom-control custom-checkbox">
69-
<input asp-for="Enabled" type="checkbox" class="custom-control-input" />
70-
<label asp-for="Enabled" class="custom-control-label"></label>
71-
</div>
72-
</div>
58+
<div class="col-2">
59+
<LabelInfo asp-for="Enabled"></LabelInfo>
60+
<input asp-for="Enabled" type="checkbox" />
7361
</div>
74-
<div class="col-3">
75-
<div class="form-control-plaintext">
76-
<div class="custom-control custom-checkbox">
77-
<input asp-for="ShowInDiscoveryDocument" type="checkbox" class="custom-control-input" />
78-
<label asp-for="ShowInDiscoveryDocument" class="custom-control-label"></label>
79-
</div>
80-
</div>
62+
<div class="col-lg-4">
63+
<LabelInfo asp-for="ShowInDiscoveryDocument"></LabelInfo>
64+
<input asp-for="ShowInDiscoveryDocument" type="checkbox" />
65+
8166
</div>
8267
</div>
8368
<hr />

src/IdentityServer/Areas/HeliosAdminUI/Views/Clients/Create.cshtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@model CreateClientViewModel
2-
@using IdentityServer.Areas.HeliosAdminUI.Dictionnary.Clients
32
@using Info = IdentityServer.Areas.HeliosAdminUI.Dictionnary.Clients.ClientsInfo
43

54
@section style{

src/IdentityServer/Views/Home/Index.cshtml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@
2929
and <a href="https://github.com/IdentityServer/IdentityServer4/tree/main/samples">ready to use samples</a>.
3030
</li>
3131

32-
<li>
33-
Click <a asp-controller="Account" asp-action="Login">here</a> to Login
34-
</li>
32+
@if (!User.Identity.IsAuthenticated)
33+
{
34+
<li>
35+
Click <a asp-controller="Account" asp-action="Login">here</a> to Login
36+
</li>
37+
}
38+
3539
</ul>
3640

3741
</div>

0 commit comments

Comments
 (0)