gnunet-svn
[Top][All Lists]
Advanced

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

[reclaim-ui] 456/459: pabc fixes


From: gnunet
Subject: [reclaim-ui] 456/459: pabc fixes
Date: Fri, 11 Jun 2021 23:29:08 +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 959a7119ef3be57b5c77f403cfe7dc6117e5cb2f
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Tue Apr 20 20:23:50 2021 +0200

    pabc fixes
---
 src/app/edit-identity/edit-identity.component.ts | 20 ++++++++++++--------
 src/app/pabc.service.ts                          | 14 ++++++++++----
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/src/app/edit-identity/edit-identity.component.ts 
b/src/app/edit-identity/edit-identity.component.ts
index 21801dc..a6e8513 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -622,30 +622,34 @@ export class EditIdentityComponent implements OnInit {
     }
     /**
      * Check for privacy credential support
+     * FIXME this is a bug in the angular plugin.
      */
     let grantedScopes = this.oauthService.getGrantedScopes();
+    console.log("Granted scopes are " + grantedScopes);
     if (!Array.isArray(grantedScopes) ||
-        !grantedScopes.includes("pabc")) {
+        !grantedScopes[0].split(' ').includes("pabc")) {
       this.importAttributesFromCredential();
       return;
     }
     console.log("Privacy credentials supported. Trying...");
-    this.pabcService.getNonceFromIssuer(this.oauthService
-                                        .issuer).subscribe(nonceParams => {
+    //FIXME the omejdn suffix is... problematic
+    this.pabcService.getNonceFromIssuer(this.oauthService.issuer + '/omejdn',
+                                       
this.oauthService.getAccessToken()).subscribe(nonceParams => {
       console.log("Got metadata: " + JSON.stringify(nonceParams));
       /* Get credential request */
       let crMetadata = {
         nonce: nonceParams.nonce,
         public_params: nonceParams.public_params,
-        issuer: this.oauthService.issuer,
+        issuer: encodeURIComponent(this.oauthService.issuer),
         id_token: this.oauthService.getIdToken(),
-        identity: this.identity
+        identity: this.identity.pubkey
       }
       this.pabcService.getCredentialRequest(crMetadata).subscribe(cr => {
         console.log("Got CR: " + JSON.stringify (cr));
-        this.pabcService.getPrivacyCredential(this.oauthService.issuer,
-                                              cr).subscribe(cred => {
-          console.log("Got Credential: " + JSON.stringify (cred));
+        this.pabcService.getPrivacyCredential(this.oauthService.issuer + 
'/omejdn',
+                                              cr,
+                                             
this.oauthService.getAccessToken()).subscribe(cred => {
+          console.log("Got Credential: " + JSON.stringify(cred));
           this.newCredential.value = cred;
           this.newCredential.name = this.importIdProvider.name + "pabc";
           this.newCredential.type = 'pabc';
diff --git a/src/app/pabc.service.ts b/src/app/pabc.service.ts
index b3f15d7..5eb345f 100644
--- a/src/app/pabc.service.ts
+++ b/src/app/pabc.service.ts
@@ -11,12 +11,18 @@ export class PabcService {
 
   constructor(private http: HttpClient, private config: ConfigService) { }
 
-  getNonceFromIssuer(issuer: string): Observable<NonceParams> {
-    return this.http.get<NonceParams>(issuer + '/pabc');
+  getNonceFromIssuer(issuer: string, at: string): Observable<NonceParams> {
+    const httpHeaders: HttpHeaders = new HttpHeaders({
+    Authorization: 'Bearer ' + at
+});
+    return this.http.get<NonceParams>(issuer + '/pabc', { headers: httpHeaders 
});
   }
 
-  getPrivacyCredential(issuer: string, cr: object): Observable<any> {
-    return this.http.post<any>(issuer + '/pabc/cr', cr);
+  getPrivacyCredential(issuer: string, cr: object, at: string): 
Observable<any> {
+    const httpHeaders: HttpHeaders = new HttpHeaders({
+    Authorization: 'Bearer ' + at
+});
+    return this.http.post<any>(issuer + '/pabc/cr', cr, { headers: httpHeaders 
});
   }
 
 

-- 
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]