[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[reclaim-ui] 213/459: Attestation is added after account is linked
From: |
gnunet |
Subject: |
[reclaim-ui] 213/459: Attestation is added after account is linked |
Date: |
Fri, 11 Jun 2021 23:25:05 +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 ac2d6b886445536b9f4c5176b0da9386a768caea
Author: anna wimbauer <anna.wibauer@gmx.de>
AuthorDate: Mon Jun 15 18:23:20 2020 +0200
Attestation is added after account is linked
---
src/app/attestation.ts | 2 +-
.../edit-attestations.component.html | 2 +-
src/app/edit-identity/edit-identity.component.html | 22 +++++--
src/app/edit-identity/edit-identity.component.ts | 67 +++++++++++-----------
src/app/reclaim.service.ts | 9 ++-
5 files changed, 60 insertions(+), 42 deletions(-)
diff --git a/src/app/attestation.ts b/src/app/attestation.ts
index dfc40ff..64fdb44 100644
--- a/src/app/attestation.ts
+++ b/src/app/attestation.ts
@@ -5,7 +5,7 @@ export class Attestation {
public id: string,
public value: string,
public type: string,
- public issuer: string,
+ public iss: string,
public expiration: number,
public attributes: Attribute[]) {}
}
diff --git a/src/app/edit-attestations/edit-attestations.component.html
b/src/app/edit-attestations/edit-attestations.component.html
index d96ec35..971779f 100644
--- a/src/app/edit-attestations/edit-attestations.component.html
+++ b/src/app/edit-attestations/edit-attestations.component.html
@@ -31,7 +31,7 @@
<div style="min-width: 15em">
</div>
</td>-->
- <td><div style="min-width: 15em">{{attestation.issuer}}</div></td>
+ <td><div style="min-width: 15em">{{attestation.iss}}</div></td>
<td>
<button class="btn btn-primary"
(click)="deleteAttestation(attestation)">
<span class="fa fa-trash"></span>
diff --git a/src/app/edit-identity/edit-identity.component.html
b/src/app/edit-identity/edit-identity.component.html
index 8221297..e4bc2fa 100644
--- a/src/app/edit-identity/edit-identity.component.html
+++ b/src/app/edit-identity/edit-identity.component.html
@@ -159,21 +159,31 @@
<div *ngIf="!emailNotFoundAlertClosed && webfingerEmail==''" class="alert
alert-danger alert-dismissible fade show my-2" role="alert">
<span class="fa fa-warning"></span> No account found with this email
</div>
+ <!--IdProvider Exists already warning-->
+ <div *ngIf="discoveredIdProviderExistsAlready() && webfingerEmail==''"
class="alert alert-danger alert-dismissible fade show my-2" role="alert">
+ <span class="fa fa-warning"></span> The Provider linked to this website
is already linked.
+ </div>
+
<button *ngIf="isExperimental() && !newIdProviderDiscovered()" class="btn
btn-primary mb-4 fhg-link" (click)="getFhGAttestation()">
<span class="fa fa-user"></span> Link Fraunhofer Account
</button>
- <!--IdProvider Exists already warning-->
- <div *ngIf="!emailNotFoundAlertClosed && webfingerEmail==''" class="alert
alert-danger alert-dismissible fade show my-2" role="alert">
- <span class="fa fa-warning"></span> This Provider linked to this website
is already linked.
- </div>
<!--Link account-->
- <button *ngIf="isExperimental() && newIdProviderDiscovered() &&
!discoveredIdProviderExistsAlready()" class="btn btn-primary mb-4 fhg-link"
(click)="loginFhgAccount()">
+ <button *ngIf="isExperimental() && newIdProviderDiscovered() &&
!discoveredIdProviderExistsAlready() && !grantedAccessToIdProvider()"
class="btn btn-primary mb-4 fhg-link" (click)="loginFhgAccount()">
<span class="fa fa-user"></span> Link {{getNewIdProviderName()}} Account
</button>
<!--Save account-->
- <button *ngIf="isExperimental() && newIdProviderDiscovered() &&
grantedAccessToIdProvider()" class="btn btn-primary mb-4 fhg-link"
(click)="saveIdProviderinLocalStorage()">
+ <div *ngIf="isExperimental() && newIdProviderDiscovered() &&
grantedAccessToIdProvider()" class="input-group my-2 col-lg-4">
+ <div class="input-group-prepend">
+ <span class="input-group-text">Attestation Name</span>
+ </div>
+ <input placeholder="Attestation Name" class="form-control"
[(ngModel)]="newAttestation.name">
+ </div>
+ <button *ngIf="isExperimental() && newIdProviderDiscovered() &&
grantedAccessToIdProvider()" [disabled]="newAttestation.name==''" class="btn
btn-primary mb-4 fhg-link" (click)="saveIdProvider()">
<span class="fa fa-user"></span> Save {{getNewIdProviderName()}} Account
</button>
+ <button *ngIf="isExperimental() && newIdProviderDiscovered()" class="btn
btn-primary mb-4 fhg-link" (click)="cancleLinking()">
+ Cancle Linking
+ </button>
<hr/>
diff --git a/src/app/edit-identity/edit-identity.component.ts
b/src/app/edit-identity/edit-identity.component.ts
index 1205a43..ef5fa72 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -31,6 +31,7 @@ export class EditIdentityComponent implements OnInit {
missingAttributes: Attribute[];
newAttribute: Attribute;
newAttested: Attribute;
+ newAttestation: Attestation;
missingAttested: Attribute[];
requestedAttested: Attribute[];
optionalAttested: Attribute[];
@@ -56,12 +57,13 @@ export class EditIdentityComponent implements OnInit {
this.optionalAttested = [];
this.attestationValues = {};
this.webfingerEmail = '';
- this.newIdProvider = '';
+ this.newIdProvider = localStorage.getItem('newIdProvider') || '';
this.emailNotFoundAlertClosed = true;
this.loadAccessTokenFromLocalStorage();
this.identity = new Identity('','');
this.newAttribute = new Attribute('', '', '', '', 'STRING', '');
this.newAttested = new Attribute('', '', '', '', 'STRING', '');
+ this.newAttestation = new Attestation('', '', '', 'JWT', '', null, []);
if (undefined !== this.activatedRoute.snapshot.queryParams["experiments"])
{
this.setExperimental("true" ===
this.activatedRoute.snapshot.queryParams["experiments"]);
}
@@ -607,7 +609,7 @@ export class EditIdentityComponent implements OnInit {
getIssuer(attribute: Attribute) {
for (let i = 0; i < this.attestations.length; i++) {
if (this.attestations[i].id == attribute.attestation) {
- return this.attestations[i].issuer;
+ return this.attestations[i].iss;
}
}
}
@@ -634,6 +636,7 @@ export class EditIdentityComponent implements OnInit {
this.isValidEmailforDiscovery();
this.webfingerService.getLink(this.webfingerEmail).subscribe (idProvider
=> {
this.newIdProvider = (idProvider.links [0]).href;
+ localStorage.setItem('newIdProvider', this.newIdProvider);
console.log(this.newIdProvider);
this.webfingerEmail == '';
},
@@ -678,30 +681,39 @@ export class EditIdentityComponent implements OnInit {
var authCodeFlowConfig =
this.oauthHelperService.getOauthConfig(this.newIdProvider);
this.oauthService.configure(authCodeFlowConfig);
this.oauthService.loadDiscoveryDocumentAndLogin();
-
-
- /* this.addAttestation().subscribe(res => {
+ }
+
+ saveIdProviderinLocalStorage(){
+ const newAccessToken: AccessToken = {
+ idProvider: this.newIdProvider,
+ accessToken: this.getAccessToken(),
+ }
+ this.accessToken.push(newAccessToken);
+ localStorage.setItem('idProvider:' + this.newIdProvider, "RedirectUri:" +
this.oauthService.redirectUri + ";ClientId: " + this.oauthService.clientId + ";
AccessToken: " + this.getAccessToken());
+ }
+
+ addAttestation() {
+ this.newAttestation.value = this.getAccessToken();
+ this.reclaimService.addAttestation(this.identity,
this.newAttestation).subscribe(res => {
+ console.log("Saved Attestation");
console.log(res);
+ this.newIdProvider = '';
+ localStorage.removeItem('newIdProvider');
this.updateAttestations();
},
err => {
+ console.log("Failed saving attestation");
console.log(err);
//this.errorInfos.push("Failed to update identity ``" +
this.identityInEdit.name + "''");
EMPTY
- });; */
+ });
+ this.newAttestation.name = '';
+ this.newAttestation.value = '';
}
- saveIdProviderinLocalStorage(){
- const newAccessToken: AccessToken = {
- idProvider: this.newIdProvider,
- accessToken: this.getAccessToken(),
- }
- this.accessToken.push(newAccessToken);
- localStorage.setItem('idProvider:' + this.newIdProvider,
this.getAccessToken());
- //addAttestation() --> idProvider needs to be saved in gnunet? Why
save IdProvider in LocalStorage if I store attestations with value on
gnunetserver?
- const newAttestation = new Attestation (this.newIdProvider,
this.getId().id, 'STRING', 'openID', this.newIdProvider,
this.getAttestationExpiration(), this.getAttestationAttributes());
- this.attestations.push(newAttestation);
- this.newIdProvider = '';
+ saveIdProvider(){
+ this.saveIdProviderinLocalStorage();
+ this.addAttestation();
}
getId (): any{
@@ -746,22 +758,13 @@ export class EditIdentityComponent implements OnInit {
}
}
-
-
- addAttestation() {
- const newAttestation = new Attestation (this.newIdProvider,
this.newIdProvider, 'STRING', 'openID', this.newIdProvider,
this.getAttestationExpiration(), this.getAttestationAttributes());
- const promises = [];
- let i;
- if (undefined !== this.attestations) {
- for (i = 0; i < this.attestations.length; i++) {
- promises.push(
- from(this.reclaimService.addAttestation(this.identity,
this.attestations[i])));
- }
- }
- if ((newAttestation.value !== '') || (newAttestation.type !== '')) {
- promises.push(from(this.reclaimService.addAttestation(this.identity,
newAttestation)));
+ cancleLinking(){
+ if (this.oauthService.hasValidAccessToken()){
+ this.oauthService.logOut();
}
- return forkJoin(promises);
+ this.newIdProvider = '';
+ localStorage.removeItem('newIdProvider');
+ this.webfingerEmail = '';
}
getAttestationExpiration(){
diff --git a/src/app/reclaim.service.ts b/src/app/reclaim.service.ts
index 029d07f..fff97b1 100644
--- a/src/app/reclaim.service.ts
+++ b/src/app/reclaim.service.ts
@@ -54,9 +54,14 @@ export class ReclaimService {
}
addAttestation(identity: Identity, attestation: Attestation) {
- return this.http.post<Attestation>(this.config.get().apiUrl +
+ var json = {
+ "name": attestation.name,
+ "type": attestation.type,
+ "value": attestation.value
+ }
+ return this.http.post(this.config.get().apiUrl +
'/reclaim/attestation/' + identity.name,
- attestation);
+ json);
}
deleteAttestation(identity: Identity, attestation: Attestation) {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [reclaim-ui] 221/459: logout on server side works #19, (continued)
- [reclaim-ui] 221/459: logout on server side works #19, gnunet, 2021/06/11
- [reclaim-ui] 220/459: attestation name duplication prevented + trying to logout on serverside, gnunet, 2021/06/11
- [reclaim-ui] 224/459: random token request deleted, gnunet, 2021/06/11
- [reclaim-ui] 209/459: trying to save accesstoken in localStorage, gnunet, 2021/06/11
- [reclaim-ui] 219/459: merge webfinger-service and oauth-helper-service into attestation-service, gnunet, 2021/06/11
- [reclaim-ui] 230/459: fix webfinger, gnunet, 2021/06/11
- [reclaim-ui] 226/459: nothing important, gnunet, 2021/06/11
- [reclaim-ui] 210/459: new Attestation created, gnunet, 2021/06/11
- [reclaim-ui] 202/459: update dependencies, gnunet, 2021/06/11
- [reclaim-ui] 196/459: issuer discoverable, gnunet, 2021/06/11
- [reclaim-ui] 213/459: Attestation is added after account is linked,
gnunet <=
- [reclaim-ui] 215/459: merge, gnunet, 2021/06/11
- [reclaim-ui] 211/459: update dependencies, gnunet, 2021/06/11
- [reclaim-ui] 223/459: button label changed, gnunet, 2021/06/11
- [reclaim-ui] 229/459: fix, gnunet, 2021/06/11
- [reclaim-ui] 238/459: improved error massage, gnunet, 2021/06/11
- [reclaim-ui] 225/459: added logout url to webfinger, gnunet, 2021/06/11
- [reclaim-ui] 212/459: Add typescript dependency to make modules happy., gnunet, 2021/06/11
- [reclaim-ui] 239/459: -fix expiration date display, gnunet, 2021/06/11
- [reclaim-ui] 231/459: maing, gnunet, 2021/06/11
- [reclaim-ui] 245/459: improved scope display, gnunet, 2021/06/11