gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[reclaim-ui] 183/459: hack constant attestation button against local IdP


From: gnunet
Subject: [reclaim-ui] 183/459: hack constant attestation button against local IdP
Date: Fri, 11 Jun 2021 23:24:35 +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 73eb74ffbcef2ef717beb7d2b0b1eaa2ebb44432
Author: Schanzenbach, Martin <mschanzenbach@posteo.de>
AuthorDate: Wed Jan 22 20:16:21 2020 +0100

    hack constant attestation button against local IdP
---
 .../edit-attestations/edit-attestations.component.html | 14 +++++++++-----
 .../edit-attestations/edit-attestations.component.ts   | 18 +++++++++++++++++-
 src/app/edit-identity/edit-identity.component.html     |  2 +-
 src/app/identity-list/identity-list.component.ts       |  5 +++++
 src/app/reclaim.service.ts                             |  5 +++++
 5 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/src/app/edit-attestations/edit-attestations.component.html 
b/src/app/edit-attestations/edit-attestations.component.html
index a565ab4..6a218a5 100644
--- a/src/app/edit-attestations/edit-attestations.component.html
+++ b/src/app/edit-attestations/edit-attestations.component.html
@@ -14,7 +14,7 @@
           <th>Attestation Name</th>
           <th>Attestation Type</th>
           <th>Attestation Value</th>
-          <th>Issuer</th>
+          <!--<th>Issuer</th>-->
           <th>Attestation ID</th>
         </tr>
       </thead>
@@ -27,11 +27,10 @@
           <td>
             <input placeholder="Attestation Value" 
[(ngModel)]="attestation.value">
           </td>
-          <td>
+<!--ISSUER          <td>
             <div style="min-width: 15em">
-              TODO <!--{{attestation_val[attestation.id]['iss']}}-->
             </div>
-          </td>
+</td>-->
           <td><div style="min-width: 15em">{{attestation.id}}</div></td>
           <td>
             <button class="btn btn-primary"  
(click)="deleteAttestation(attestation)">
@@ -52,6 +51,8 @@
           <td>
             <input placeholder="Attestation Value" 
[class.text-danger]="!attestationValueValid(newAttestation)" 
[(ngModel)]="newAttestation.value">
           </td>
+          <td>
+          </td>
           <td>
             <button [disabled]="!canAddAttestation(newAttestation)" class="btn 
btn-primary"  (click)="addAttestation()">
               <span class="fa fa-plus"></span> 
@@ -69,7 +70,10 @@
         <li>Types and values may not be empty!</li>
       </ul>
     </div>
-
+    <button class="btn btn-primary mb-4" (click)="getFhGAttestation()">
+      <span class="fa fa-user"></span> Get Fraunhofer Credentials
+    </button>
+    <hr/>
     <!-- Edit card buttons -->
     <div>
       <button class="btn btn-primary" (click)="saveAttestation()" 
[disabled]="!canSaveAttestation()">
diff --git a/src/app/edit-attestations/edit-attestations.component.ts 
b/src/app/edit-attestations/edit-attestations.component.ts
index a05b14a..04df369 100644
--- a/src/app/edit-attestations/edit-attestations.component.ts
+++ b/src/app/edit-attestations/edit-attestations.component.ts
@@ -43,7 +43,19 @@ export class EditAttestationsComponent implements OnInit {
           }
         });
     });
-
+    let code = localStorage.getItem('attestationCode');
+    if (undefined !== code) {
+      console.log(code);
+      this.reclaimService.fixmeExchangeCode(code).subscribe(response => {
+        if (undefined !== response["id_token"]) {
+          this.newAttestation.value = response["id_token"];
+          this.newAttestation.type = "JWT";
+          this.newAttestation.name = "FraunhoferAISEC";
+          this.addAttestation();
+          localStorage.setItem('attestationCode', null);
+        }
+      });;
+    }
   }
 
   private updateAttestation() {
@@ -204,4 +216,8 @@ export class EditAttestationsComponent implements OnInit {
     return this.attestationValues[attestation.id]['exp'] > now;
   }
 
+  getFhGAttestation() {
+    localStorage.setItem('userForAttestation', this.identity.name);
+    window.location.href = 
"http://localhost:4567/authorize?redirect_uri=http%3A%2F%2Flocalhost:4200%2Findex.html&client_id=reclaimid&response_type=code&scopes=openid";;
+  }
 }
diff --git a/src/app/edit-identity/edit-identity.component.html 
b/src/app/edit-identity/edit-identity.component.html
index 3a2e193..1c42501 100644
--- a/src/app/edit-identity/edit-identity.component.html
+++ b/src/app/edit-identity/edit-identity.component.html
@@ -86,7 +86,7 @@
               </button>
             </td>
           </tr>
-          <tr [class.alert-danger]="isRefInConflict(newReference)">
+          <tr [class.alert-danger]="isRefInConflict(newReference)" *ngIf="0 != 
attestations.length">
             <td>
               <input [class.text-danger]="!referenceNameValid(newReference)" 
placeholder="Reference" [(ngModel)]="newReference.name">
             </td>
diff --git a/src/app/identity-list/identity-list.component.ts 
b/src/app/identity-list/identity-list.component.ts
index f50c415..cd7e172 100644
--- a/src/app/identity-list/identity-list.component.ts
+++ b/src/app/identity-list/identity-list.component.ts
@@ -56,6 +56,11 @@ export class IdentityListComponent implements OnInit {
     this.optionalReferences = {};
     this.connected = false;
     this.modalOpened = false;
+    if (undefined !== this.route.snapshot.queryParams["code"]) {
+      localStorage.setItem('attestationCode', 
this.route.snapshot.queryParams["code"]);
+      var user = localStorage.getItem('userForAttestation');
+      this.router.navigate(['/edit-attestations', user]);
+    }
     if (!this.oidcService.inOpenIdFlow()) {
       this.oidcService.parseRouteParams(this.route.snapshot.queryParams);
       if (this.oidcService.inOpenIdFlow()) {
diff --git a/src/app/reclaim.service.ts b/src/app/reclaim.service.ts
index 94bb3b3..20bdac5 100644
--- a/src/app/reclaim.service.ts
+++ b/src/app/reclaim.service.ts
@@ -82,4 +82,9 @@ export class ReclaimService {
       '/reclaim/attestation/parse',json
       );
   }
+
+  fixmeExchangeCode(code: String) {
+    let json = JSON.parse("{}");
+    return 
this.http.post("http://localhost:4567/token?grant_type=authorization_code&client_id=reclaimid&redirect_uri=http://localhost:4200/index.html&scope=openid&code="+code,
 json);
+  }
 }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]