-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store redirect URIs for One Login clients (#1162)
- Loading branch information
Showing
15 changed files
with
1,631 additions
and
100 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
1,193 changes: 1,193 additions & 0 deletions
1,193
...stem.Core/DataStore/Postgres/Migrations/20240208134232_OneLoginAuthSchemeInfo.Designer.cs
Large diffs are not rendered by default.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
...gRecordSystem.Core/DataStore/Postgres/Migrations/20240208134232_OneLoginAuthSchemeInfo.cs
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,72 @@ | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace TeachingRecordSystem.Core.DataStore.Postgres.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class OneLoginAuthSchemeInfo : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.AddColumn<bool>( | ||
name: "is_oidc_client", | ||
table: "users", | ||
type: "boolean", | ||
nullable: true); | ||
|
||
migrationBuilder.AddColumn<string>( | ||
name: "one_login_authentication_scheme_name", | ||
table: "users", | ||
type: "character varying(50)", | ||
maxLength: 50, | ||
nullable: true); | ||
|
||
migrationBuilder.AddColumn<string>( | ||
name: "one_login_post_logout_redirect_uri_path", | ||
table: "users", | ||
type: "character varying(100)", | ||
maxLength: 100, | ||
nullable: true); | ||
|
||
migrationBuilder.AddColumn<string>( | ||
name: "one_login_redirect_uri_path", | ||
table: "users", | ||
type: "character varying(100)", | ||
maxLength: 100, | ||
nullable: true); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "ix_users_one_login_authentication_scheme_name", | ||
table: "users", | ||
column: "one_login_authentication_scheme_name", | ||
unique: true, | ||
filter: "one_login_authentication_scheme_name is not null"); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropIndex( | ||
name: "ix_users_one_login_authentication_scheme_name", | ||
table: "users"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "is_oidc_client", | ||
table: "users"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "one_login_authentication_scheme_name", | ||
table: "users"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "one_login_post_logout_redirect_uri_path", | ||
table: "users"); | ||
|
||
migrationBuilder.DropColumn( | ||
name: "one_login_redirect_uri_path", | ||
table: "users"); | ||
} | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
@page "/application-users/{userId}" | ||
@addTagHelper *, Joonasw.AspNetCore.SecurityHeaders | ||
@model TeachingRecordSystem.SupportUi.Pages.ApplicationUsers.EditApplicationUserModel | ||
@inject IClock Clock | ||
@{ | ||
|
@@ -41,7 +42,7 @@ | |
{ | ||
<tr class="govuk-table__row"> | ||
<td class="govuk-table__cell"> | ||
<a href="@LinkGenerator.EditApiKey(key.ApiKeyId)" class="govuk-link" data-testid="[email protected]">@key.ApiKeyId</a> | ||
<a href="@LinkGenerator.EditApiKey(key.ApiKeyId)" class="govuk-link trs-monospace" data-testid="[email protected]">@key.ApiKeyId</a> | ||
</td> | ||
<td class="govuk-table__cell" data-testid="Expiry"> | ||
@if (key.Expires is DateTime expires) | ||
|
@@ -75,11 +76,54 @@ | |
<govuk-button-link href="@LinkGenerator.AddApiKey(Model.UserId)" class="govuk-button--secondary" data-testid="AddApiKey">Add API key</govuk-button-link> | ||
</div> | ||
|
||
<h2 class="govuk-heading-m">One Login</h2> | ||
<govuk-input asp-for="OneLoginClientId" label-class="govuk-label--s" autocomplete="off" /> | ||
<govuk-textarea asp-for="OneLoginPrivateKeyPem" label-class="govuk-label--s" /> | ||
<govuk-checkboxes asp-for="IsOidcClient"> | ||
<govuk-checkboxes-item value="@true" label-class="govuk-label--m"> | ||
@Html.DisplayNameFor(m => m.IsOidcClient) | ||
<govuk-checkboxes-item-conditional> | ||
<govuk-input asp-for="OneLoginAuthenticationSchemeName" label-class="govuk-label--s" input-class="govuk-!-width-one-half trs-monospace" autocomplete="off" spellcheck="false" /> | ||
|
||
<govuk-input asp-for="OneLoginClientId" label-class="govuk-label--s" input-class="trs-monospace" autocomplete="off" spellcheck="false" /> | ||
|
||
<govuk-textarea asp-for="OneLoginPrivateKeyPem" label-class="govuk-label--s" textarea-class="trs-monospace trs-nowrap" autocomplete="off" spellcheck="false" /> | ||
|
||
<govuk-input asp-for="OneLoginRedirectUriPath" label-class="govuk-label--s" autocomplete="off" spellcheck="false"> | ||
<govuk-input-prefix>@Model.OneLoginRedirectUriBase</govuk-input-prefix> | ||
</govuk-input> | ||
|
||
<govuk-input asp-for="OneLoginPostLogoutRedirectUriPath" label-class="govuk-label--s" autocomplete="off" spellcheck="false"> | ||
<govuk-input-prefix>@Model.OneLoginRedirectUriBase</govuk-input-prefix> | ||
</govuk-input> | ||
</govuk-checkboxes-item-conditional> | ||
</govuk-checkboxes-item> | ||
</govuk-checkboxes> | ||
|
||
<govuk-button type="submit">Save changes</govuk-button> | ||
</form> | ||
</div> | ||
</div> | ||
|
||
<template id="showkey"> | ||
<govuk-checkboxes name="ShowKey" input-id="ShowKey" class="govuk-checkboxes--small"> | ||
<govuk-checkboxes-item value="true">Show key</govuk-checkboxes-item> | ||
</govuk-checkboxes> | ||
</template> | ||
|
||
<script type="text/javascript" asp-add-nonce="true"> | ||
if ('content' in document.createElement('template')) { | ||
const keyInput = document.querySelector("#@Html.IdFor(m => m.OneLoginPrivateKeyPem)"); | ||
if (keyInput.value) { | ||
const showKeyTemplate = document.querySelector('#showkey'); | ||
const showKey = showKeyTemplate.content.cloneNode(true); | ||
const showKeyCheckbox = showKey.querySelector('input'); | ||
const setInputTypeFromShowKeyValue = () => keyInput.style.display = showKeyCheckbox.checked ? '' : 'none'; | ||
setInputTypeFromShowKeyValue(); | ||
showKeyCheckbox.addEventListener('change', setInputTypeFromShowKeyValue); | ||
const keyFormGroup = keyInput.parentNode; | ||
keyInput.classList.add('govuk-!-margin-bottom-0'); | ||
keyFormGroup.querySelector('.govuk-hint').after(showKey); | ||
} | ||
} | ||
</script> |
Oops, something went wrong.