gnunet-svn
[Top][All Lists]
Advanced

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

[reclaim-ui] 297/459: fix claim processing


From: gnunet
Subject: [reclaim-ui] 297/459: fix claim processing
Date: Fri, 11 Jun 2021 23:26:29 +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 4bd12049941df9993b19f75dedad0501c88a2e29
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Thu Aug 13 16:11:45 2020 +0200

    fix claim processing
---
 src/app/open-id.service.ts | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/app/open-id.service.ts b/src/app/open-id.service.ts
index 47f3c38..f8590e5 100644
--- a/src/app/open-id.service.ts
+++ b/src/app/open-id.service.ts
@@ -346,13 +346,30 @@ export class OpenIdService {
       return [];
     }
     var claims = [];
-    var json = JSON.parse(this.params['claims'])['userinfo'];
-    for(var key in json)
+    var json = [];
+    try {
+      json = JSON.parse(this.params['claims']);
+    } catch(e) {
+      console.log(e);
+      return claims;
+    }
+    if (undefined === json) { return claims };
+    var userinfo = json['userinfo']
+    if (undefined === userinfo) { return claims };
+    var claimkeys = [];
+    for(var key in userinfo)
     {
-      if (json[key]['attestation'] === true)
-        {
-          claims.push([key, json[key]['essential'], json[key]['attestation'], 
json[key]['format']]);
-        }
+      claims.push([key, userinfo[key]['essential'], 
userinfo[key]['attestation'], userinfo[key]['format']]);
+      claimkeys.push(key);
+    }
+    var idtoken = json['id_token'];
+    if (undefined === idtoken) { return claims };
+    for(var key in idtoken)
+    {
+      if (!claimkeys.includes(key))
+      {
+        claims.push([key, idtoken[key]['essential'], 
idtoken[key]['attestation'], idtoken[key]['format']]);
+      }
     }
     return claims;
   }

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