api: add basic jwt support with required scope (#2624)

* api: add basic jwt support with required scope

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

* api: only set auth_via when actually authenticating via token

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

* save consented permissions in user consent, re-prompt when new permissions are required

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

* update locale

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

* translate special scope map

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

* more api auth tests

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

* add docs

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

* build web api in e2e tests

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

* link generated client instead of copying

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens L
2022-06-26 17:51:15 +02:00
committed by GitHub
parent 768f073e49
commit c5a2831665
26 changed files with 3064 additions and 437 deletions

View File

@ -36,6 +36,66 @@ export class ConsentStage extends BaseStage<ConsentChallenge, ConsentChallengeRe
];
}
renderNoPrevious(): TemplateResult {
return html`
<div class="pf-c-form__group">
<p id="header-text" class="pf-u-mb-xl">${this.challenge.headerText}</p>
${this.challenge.permissions.length > 0
? html`
<p class="pf-u-mb-sm">
${t`Application requires following permissions:`}
</p>
<ul class="pf-c-list" id="permmissions">
${this.challenge.permissions.map((permission) => {
return html`<li data-permission-code="${permission.id}">
${permission.name}
</li>`;
})}
</ul>
`
: html``}
</div>
`;
}
renderAdditional(): TemplateResult {
return html`
<div class="pf-c-form__group">
<p id="header-text" class="pf-u-mb-xl">${this.challenge.headerText}</p>
${this.challenge.permissions.length > 0
? html`
<p class="pf-u-mb-sm">
${t`Application already has access to the following permissions:`}
</p>
<ul class="pf-c-list" id="permmissions">
${this.challenge.permissions.map((permission) => {
return html`<li data-permission-code="${permission.id}">
${permission.name}
</li>`;
})}
</ul>
`
: html``}
</div>
<div class="pf-c-form__group pf-u-mt-md">
${this.challenge.additionalPermissions.length > 0
? html`
<strong class="pf-u-mb-sm">
${t`Application requires following new permissions:`}
</strong>
<ul class="pf-c-list" id="permmissions">
${this.challenge.additionalPermissions.map((permission) => {
return html`<li data-permission-code="${permission.id}">
${permission.name}
</li>`;
})}
</ul>
`
: html``}
</div>
`;
}
render(): TemplateResult {
if (!this.challenge) {
return html`<ak-empty-state ?loading="${true}" header=${t`Loading`}> </ak-empty-state>`;
@ -61,23 +121,9 @@ export class ConsentStage extends BaseStage<ConsentChallenge, ConsentChallengeRe
>
</div>
</ak-form-static>
<div class="pf-c-form__group">
<p id="header-text" class="pf-u-mb-xl">${this.challenge.headerText}</p>
${this.challenge.permissions.length > 0
? html`
<p class="pf-u-mb-sm">
${t`Application requires following permissions:`}
</p>
<ul class="pf-c-list" id="permmissions">
${this.challenge.permissions.map((permission) => {
return html`<li data-permission-code="${permission.id}">
${permission.name}
</li>`;
})}
</ul>
`
: html``}
</div>
${this.challenge.additionalPermissions.length > 0
? this.renderAdditional()
: this.renderNoPrevious()}
<div class="pf-c-form__group pf-m-action">
<button type="submit" class="pf-c-button pf-m-primary pf-m-block">