Add Token setting Lifetime of Request URI for PAR (#28155)

* Add Token setting Lifetime of Request URI for PAR

Signed-off-by: Stan Silvert <ssilvert@redhat.com>

* Fix test.

Signed-off-by: Stan Silvert <ssilvert@redhat.com>

---------

Signed-off-by: Stan Silvert <ssilvert@redhat.com>
This commit is contained in:
Stan Silvert 2024-03-25 08:33:39 -04:00 committed by GitHub
parent 270be86397
commit 7dfc263052
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 45 additions and 3 deletions

View file

@ -344,6 +344,10 @@ describe("Realm settings events tab tests", () => {
"have.value",
1,
);
cy.findByTestId(realmSettingsPage.parRequestUriLifespanInput).should(
"have.value",
2,
);
cy.findByTestId(realmSettingsPage.accessTokenLifespanImplicitInput).should(
"have.value",
2,

View file

@ -116,6 +116,7 @@ export default class RealmSettingsPage extends CommonPage {
revokeRefreshTokenSwitch = "revoke-refresh-token-switch";
accessTokenLifespanInput = "access-token-lifespan-input";
accessTokenLifespanImplicitInput = "access-token-lifespan-implicit-input";
parRequestUriLifespanInput = "par-request-uri-lifespan-input";
clientLoginTimeoutInput = "client-login-timeout-input";
offlineSessionMaxInput = "offline-session-max-input";
userInitiatedActionLifespanInput = "user-initiated-action-lifespan";
@ -129,6 +130,10 @@ export default class RealmSettingsPage extends CommonPage {
accessTokenLifespanSelectMenuList =
"#kc-access-token-lifespan-select-menu > div > ul";
parRequestUriLifespanSelectMenu = "#par-request-uri-lifespan-select-menu";
parRequestUriLifespanSelectMenuList =
"#par-request-uri-lifespan-select-menu > div > ul";
accessTokenLifespanImplicitSelectMenu =
"#kc-access-token-lifespan-implicit-select-menu";
accessTokenLifespanImplicitSelectMenuList =
@ -631,6 +636,12 @@ export default class RealmSettingsPage extends CommonPage {
this.accessTokenLifespanImplicitSelectMenu,
this.accessTokenLifespanImplicitSelectMenuList,
);
cy.findByTestId("par-request-uri-lifespan-input").clear().type("2");
this.changeTimeUnit(
"Hours",
this.parRequestUriLifespanSelectMenu,
this.parRequestUriLifespanSelectMenuList,
);
cy.findByTestId(this.clientLoginTimeoutInput).clear().type("3");
this.changeTimeUnit(
@ -1014,16 +1025,16 @@ export default class RealmSettingsPage extends CommonPage {
cy.findByTestId(this.#jsonEditorReloadBtn).click();
cy.get(this.#jsonEditor).type(`{pageup}{del} [{
"name": "Reload",
"name": "Reload",
}, {downarrow}{end}{backspace}{backspace}{backspace}{backspace}`);
cy.findByTestId(this.#jsonEditorReloadBtn).click();
cy.get(this.#jsonEditor).type(`{pageup}{del} [{
"name": "Test",
"name": "Test",
"description": "Test Description",
"enabled": false,
"conditions": [],
"conditions": [],
"profiles": [],
}, {downarrow}{end}{backspace}{backspace}{backspace}{backspace}`);

View file

@ -3113,3 +3113,5 @@ senderEnvelopePlaceholder=Sender envelope email address
smtpPortPlaceholder=SMTP port (defaults to 25)
loginUsernamePlaceholder=Login username
ownerHelp=Owner for this resource.
parRequestUriLifespan=Lifetime of the Request URI for Pushed Authorization Request
parRequestUriLifespanHelp=Number that represents the lifetime of the request URI. The default value is 1 minute.

View file

@ -200,6 +200,31 @@ export const RealmSettingsTokensTab = ({
{...form.register("attributes.shortVerificationUri")}
/>
</FormGroup>
<FormGroup
label={t("parRequestUriLifespan")}
fieldId="parRequestUriLifespan"
labelIcon={
<HelpItem
helpText={t("parRequestUriLifespanHelp")}
fieldLabelId="parRequestUriLifespan"
/>
}
>
<Controller
name="attributes.parRequestUriLifespan"
control={form.control}
render={({ field }) => (
<TimeSelector
id="parRequestUriLifespan"
className="par-request-uri-lifespan"
data-testid="par-request-uri-lifespan-input"
aria-label="par-request-uri-lifespan"
value={field.value}
onChange={field.onChange}
/>
)}
/>
</FormGroup>
</>
)}
</FormAccess>