[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[reclaim-ui] 364/459: fine tuning authorization
From: |
gnunet |
Subject: |
[reclaim-ui] 364/459: fine tuning authorization |
Date: |
Fri, 11 Jun 2021 23:27:36 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository reclaim-ui.
commit 344e0af7df36e8d4a078c57777cccdbdabb3f800
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Wed Oct 28 16:28:15 2020 +0100
fine tuning authorization
---
.../authorization-request.component.html | 39 ----------------------
.../authorization-request.component.ts | 20 +++++++++--
src/app/identity-list/identity-list.component.html | 38 ++++++++++-----------
src/app/identity-list/identity-list.component.ts | 14 ++------
src/app/open-id.service.ts | 26 +++------------
src/locales/de/messages.json | 4 +--
6 files changed, 44 insertions(+), 97 deletions(-)
diff --git a/src/app/authorization-request/authorization-request.component.html
b/src/app/authorization-request/authorization-request.component.html
index 15f801d..4d43cd4 100644
--- a/src/app/authorization-request/authorization-request.component.html
+++ b/src/app/authorization-request/authorization-request.component.html
@@ -8,45 +8,6 @@
</span>
<br/>
</div>
-<div class="card" *ngIf="isClientVerified()" style="margin-left:30%;
width:40%;">
- <div class="card-body" >
- <strong>{{ oidcService.clientName }}</strong>
- {{getMessage("authorization_request_html@chooseId1")}}
- <br/>
- {{getMessage("authorization_request_html@chooseId1")}}
- <ul>
- <li *ngFor="let attribute of
getRequestedStandardScopesWithDescription()"><strong>{{attribute}}</strong></li>
- </ul>
- <div *ngIf="getRequestedNonStandardClaims().length > 0">
- {{getMessage("authorization_request_html@attributes")}}
- <ul>
- <li *ngFor="let attribute of
getRequestedNonStandardClaims()"><strong>{{attribute}}</strong></li>
- </ul>
- </div>
- </div>
- <!-- Sharing disclaimer -->
- <div class="alert alert-warning alert-dismissible fade show mb-1"
role="alert">
- <i class="fa fa-exclamation-triangle mr-2"></i>
-
<strong>{{getMessage("authorization_request_html@personalDataWarning1")}}</strong>
- {{getMessage("authorization_request_html@personalDataWarning2",
{CLIENTNAME: oidcService.clientName})}}
- </div>
- <div style="margin: 1em;">
- <button class="btn btn-danger m-1 mt-4" *ngIf="isClientVerified()"
(click)="cancelRequest()" style="margin-bottom: -4%;">
- <span class="fa fa-ban"></span> {{getMessage("Decline")}}
- </button>
- <button class="btn btn-primary m-1 mt-4" [routerLink]="['/']"
*ngIf="isClientVerified()">
- <span class="fa fa-arrow-circle-right"></span>
{{getMessage("authorization_request_html@selectId")}}
- </button>
- </div>
-</div>
-<div *ngIf="isClientVerified() !== undefined && !isClientVerified()"
style="text-align: center;">
- <div class="alert alert-danger show" role="alert">
- <b >{{getMessage("authorization_request_html@authFailed")}}</b><br/>
- <button class="btn btn-primary mt-4" *ngIf="!isClientVerified()"
(click)="retryVerify();">
- <span class="fa fa-openid"></span>
{{getMessage("authorization_request_html@retry")}}
- </button>
- </div>
-</div>
<div *ngIf="isClientVerified() === undefined" style="text-align: center;">
<button class="btn btn-danger mt-4" *ngIf="isClientVerified() === undefined"
(click)="cancelRequest()">
<span class="fa fa-ban"></span>
{{getMessage("authorization_request_html@cancelRequest")}}
diff --git a/src/app/authorization-request/authorization-request.component.ts
b/src/app/authorization-request/authorization-request.component.ts
index 70762bf..bba6413 100644
--- a/src/app/authorization-request/authorization-request.component.ts
+++ b/src/app/authorization-request/authorization-request.component.ts
@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { OpenIdService } from '../open-id.service';
+import { GnsService } from '../gns.service';
import { LanguageService } from '../language.service';
/* For Chrome browsers */
@@ -16,6 +17,7 @@ export class AuthorizationRequestComponent implements OnInit {
browser: typeof browser;
constructor(private oidcService: OpenIdService,
+ private gnsService: GnsService,
private languageService: LanguageService,
private router: Router) { }
@@ -44,13 +46,25 @@ export class AuthorizationRequestComponent implements
OnInit {
}
retryVerify() {
- this.oidcService.getClientName();
+ this.gnsService.getClientName(this.oidcService.getClientId())
+ .subscribe(record => {
+ const records = record.data;
+ console.log(records);
+ for (let i = 0; i < records.length; i++) {
+ if (records[i].record_type !== 'RECLAIM_OIDC_CLIENT') {
+ continue;
+ }
+ this.oidcService.setClientName(records[i].value);
+ this.router.navigate(['/']);
+ return;
+ }
+ }, err => {
+ console.log(err);
+ });
}
//Internationalization
getMessage(key, sub?){
return this.languageService.getMessage(key, sub);
}
-
-
}
diff --git a/src/app/identity-list/identity-list.component.html
b/src/app/identity-list/identity-list.component.html
index 572c7d4..0fac20f 100644
--- a/src/app/identity-list/identity-list.component.html
+++ b/src/app/identity-list/identity-list.component.html
@@ -7,25 +7,8 @@
</div>
</oid-modal>
-
-
-<!-- Buttons -->
-<div *ngIf="canSearch()" style="margin-top: 1em; text-align: center;">
- <!-- Identity search -->
- <div class="form-inline" style="display: table; margin: auto;">
- <div class="search-wrapper">
- <input class="form-control mr-sm-2" type="search"
[(ngModel)]="searchTerm" name="searchTerm"
- placeholder="{{ getMessage('identity_list_html@searchbarPlaceholder')
}}" style="border-radius: 2em;">
- </div>
- <button class="btn btn-primary" [routerLink]="['/new-identity']">
- <span class="fa fa-user-plus"></span> {{
getMessage("identity_list_html@newId") }}
- </button>
- </div>
- <br />
-</div>
-
<!--Authorization Request-->
-<div class="alert alert-warning alert-dismissible fade show mb-1" role="alert"
*ngIf="authorizationRequest">
+<div class="alert alert-info alert-dismissible fade show mb-1" role="alert"
*ngIf="inOpenIdFlow()">
<div style="text-align: center;">
<i class="fa fa-2x fa-openid"></i>
<b class="fa-2x">
{{getMessage("authorization_request_html@personalInfo")}} </b>
@@ -57,6 +40,23 @@
</div>
</div>
+
+
+<!-- Buttons -->
+<div *ngIf="canSearch()" style="margin-top: 1em; text-align: center;">
+ <!-- Identity search -->
+ <div class="form-inline" style="display: table; margin: auto;">
+ <div class="search-wrapper">
+ <input class="form-control mr-sm-2" type="search"
[(ngModel)]="searchTerm" name="searchTerm"
+ placeholder="{{ getMessage('identity_list_html@searchbarPlaceholder')
}}" style="border-radius: 2em;">
+ </div>
+ <button class="btn btn-primary" [routerLink]="['/new-identity']">
+ <span class="fa fa-user-plus"></span> {{
getMessage("identity_list_html@newId") }}
+ </button>
+ </div>
+ <br />
+</div>
+
<!-- Cancel authorization -->
<div style="margin-bottom: 1em; text-align: center;" *ngIf="inOpenIdFlow()">
<button *ngIf="inOpenIdFlow() && isClientVerified() !== undefined &&
isClientVerified()" class="btn btn-danger mt-2" (click)="cancelRequest()">
@@ -209,4 +209,4 @@
</div>
</div>
</div>
-</div>
\ No newline at end of file
+</div>
diff --git a/src/app/identity-list/identity-list.component.ts
b/src/app/identity-list/identity-list.component.ts
index 9ac3ff0..8c44d79 100644
--- a/src/app/identity-list/identity-list.component.ts
+++ b/src/app/identity-list/identity-list.component.ts
@@ -40,7 +40,6 @@ export class IdentityListComponent implements OnInit {
showSharingInfo: any = '';
sortAttributeByStandardClaim: any;
openIdentity: any = '';
- authorizationRequest: any;
constructor(private route: ActivatedRoute, private oidcService:
OpenIdService,
private identityService: IdentityService,
@@ -61,7 +60,6 @@ export class IdentityListComponent implements OnInit {
this.missingClaims = {};
this.connected = false;
this.modalOpened = false;
- this.authorizationRequest = false;
if (undefined !== this.route.snapshot.queryParams["code"]) {
localStorage.setItem('credentialCode',
this.route.snapshot.queryParams["code"]);
localStorage.setItem('credentialState',
this.route.snapshot.queryParams["state"]);
@@ -76,10 +74,8 @@ export class IdentityListComponent implements OnInit {
if (!this.oidcService.inOpenIdFlow() && undefined ==
this.route.snapshot.queryParams["authz_request"]) {
this.oidcService.parseRouteParams(this.route.snapshot.queryParams);
if (this.oidcService.inOpenIdFlow()) {
- /**this.router.navigate(['/authorization-request']);
- return;*/
- this.retryVerify();
- this.authorizationRequest = true;
+ this.router.navigate(['/authorization-request']);
+ return;
}
}
this.updateIdentities();
@@ -95,7 +91,6 @@ export class IdentityListComponent implements OnInit {
}
cancelRequest() {
- this.authorizationRequest = false;
this.oidcService.cancelAuthorization();
}
@@ -504,9 +499,4 @@ export class IdentityListComponent implements OnInit {
getMessage(key, sub?){
return this.languageService.getMessage(key, sub);
}
-
- //Authorization Request
- retryVerify() {
- this.oidcService.getClientName();
- }
}
diff --git a/src/app/open-id.service.ts b/src/app/open-id.service.ts
index 1fe29b4..a4a85b3 100644
--- a/src/app/open-id.service.ts
+++ b/src/app/open-id.service.ts
@@ -28,30 +28,12 @@ export class OpenIdService {
this.params = {};
this.inOidcFlow = false;
this.referenceString = "";
+ this.clientNameVerified = undefined;
}
- getClientName() {
- this.clientNameVerified = undefined;
- if (!this.inOpenIdFlow()) {
- return;
- }
- this.gnsService.getClientName(this.getClientId())
- .subscribe(record => {
- const records = record.data;
- console.log(records);
- for (let i = 0; i < records.length; i++) {
- if (records[i].record_type !== 'RECLAIM_OIDC_CLIENT') {
- continue;
- }
- this.clientName = records[i].value;
- this.clientNameVerified = true;
- return;
- }
- this.clientNameVerified = false;
- }, err => {
- console.log(err);
- this.clientNameVerified = false;
- });
+ setClientName(name: string) {
+ this.clientName = name;
+ this.clientNameVerified = true;
}
isClientVerified() { return this.clientNameVerified; }
diff --git a/src/locales/de/messages.json b/src/locales/de/messages.json
index b999048..ec2500f 100644
--- a/src/locales/de/messages.json
+++ b/src/locales/de/messages.json
@@ -12,8 +12,8 @@
"Value": "Wert",
"authorization_request_html@personalInfo": "Persönliche Datenabfrage",
"authorization_request_html@verifyRequest": "Verifiziere Anfrage, bitte
warten…",
- "authorization_request_html@chooseId1": "frägt persönliche Daten an.\n
Wähle eine Identität und erlaube damit den Zugriff die folgenden Daten:",
- "authorization_request_html@chooseId2": "Wähle eine Identität und erlaube
damit Zugriff auf die blau markierten Daten",
+ "authorization_request_html@chooseId1": "frägt persönliche Daten an.",
+ "authorization_request_html@chooseId2": "Wähle eine Identität und erlaube
damit Zugriff auf die blau markierten Daten.",
"authorization_request_html@attributes": "zudem werden die folgenden
freiwilligen Angaben angefragt:",
"authorization_request_html@personalDataWarning1": "Sei vorsichtig mit wem
du deine persönlichen Daten teilst!",
"authorization_request_html@personalDataWarning2": "Wenn du mit
{{CLIENTNAME}} keine persönlichen Daten teilenwillst,\nkannst du die Anfrage
ablehnen.\nDu hast die Möglichkeit Daten permanent von Identitäten zu löschen
bevor\ndu der Anfrage zustimmst.",
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [reclaim-ui] 378/459: update, (continued)
- [reclaim-ui] 378/459: update, gnunet, 2021/06/11
- [reclaim-ui] 379/459: minor, gnunet, 2021/06/11
- [reclaim-ui] 356/459: Merge branch 'master' of gitlab.com:reclaimid/ui, gnunet, 2021/06/11
- [reclaim-ui] 335/459: add template, gnunet, 2021/06/11
- [reclaim-ui] 391/459: fix requested attribute, gnunet, 2021/06/11
- [reclaim-ui] 363/459: fix radio button, gnunet, 2021/06/11
- [reclaim-ui] 362/459: missing credential source, gnunet, 2021/06/11
- [reclaim-ui] 403/459: update state loading, gnunet, 2021/06/11
- [reclaim-ui] 361/459: authorization request dialog in identity list, gnunet, 2021/06/11
- [reclaim-ui] 370/459: build fix, gnunet, 2021/06/11
- [reclaim-ui] 364/459: fine tuning authorization,
gnunet <=
- [reclaim-ui] 401/459: improve import logic and UI, gnunet, 2021/06/11
- [reclaim-ui] 320/459: works on chrome, gnunet, 2021/06/11
- [reclaim-ui] 342/459: Translated using Weblate (German), gnunet, 2021/06/11
- [reclaim-ui] 349/459: fix translations, gnunet, 2021/06/11
- [reclaim-ui] 387/459: update, gnunet, 2021/06/11
- [reclaim-ui] 358/459: clean up, gnunet, 2021/06/11
- [reclaim-ui] 386/459: fix import for browser plugin, other import may be broken, gnunet, 2021/06/11
- [reclaim-ui] 394/459: fix default selection, gnunet, 2021/06/11
- [reclaim-ui] 369/459: add code for straight attribute import, gnunet, 2021/06/11
- [reclaim-ui] 407/459: use share icon, gnunet, 2021/06/11