Skip to content

Commit

Permalink
Add a checkbox to enable/disable PS256 signing
Browse files Browse the repository at this point in the history
  • Loading branch information
DebugOk committed Mar 11, 2024
1 parent 687c364 commit 42946ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
<label asp-for="Input.RequirePkce" class="form-check-label"></label>
</div>
</div>
<div class="form-group">
<div class="form-check">
<input asp-for="Input.AllowPS256" class="form-check-input"/>
<label asp-for="Input.AllowPS256" class="form-check-label"></label>
</div>
</div>
<button type="submit" asp-page-handler="Update" class="btn btn-primary">Update</button>
</form>
<div class="col-lg-6">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public sealed class InputModel
[Required]
[DisplayName("Require PKCE")]
public bool RequirePkce { get; set; }

[Required]
[DisplayName("Allow PS256 signing")]
public bool AllowPS256 { get; set; } = true;
}

public Manage(ApplicationDbContext dbContext, UserManager<SpaceUser> userManager)
Expand All @@ -62,7 +66,8 @@ public async Task<IActionResult> OnGetAsync(int client)
Name = App.Client.ClientName,
CallbackUrl = App.Client.RedirectUris.FirstOrDefault()?.RedirectUri ?? "",
HomepageUrl = App.Client.ClientUri,
RequirePkce = App.Client.RequirePkce
RequirePkce = App.Client.RequirePkce,
AllowPS256 = App.Client.AllowedIdentityTokenSigningAlgorithms?.Contains("PS256") ?? false
};

return Page();
Expand All @@ -77,6 +82,7 @@ public async Task<IActionResult> OnPostUpdateAsync(int client)
App.Client.RedirectUris = new List<ClientRedirectUri> { new() { RedirectUri = Input.CallbackUrl } };
App.Client.ClientUri = Input.HomepageUrl;
App.Client.RequirePkce = Input.RequirePkce;
App.Client.AllowedIdentityTokenSigningAlgorithms = Input.AllowPS256 ? "PS256" : null;

await _dbContext.SaveChangesAsync();

Expand Down

0 comments on commit 42946ad

Please sign in to comment.