gnunet-svn
[Top][All Lists]
Advanced

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

[reclaim-ui] 403/459: update state loading


From: gnunet
Subject: [reclaim-ui] 403/459: update state loading
Date: Fri, 11 Jun 2021 23:28:15 +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 f95cc3008b4128adad290da24521172cb83d2e03
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Tue Jan 5 16:13:58 2021 +0900

    update state loading
---
 src/app/edit-identity/edit-identity.component.ts | 10 ++++++++++
 src/app/open-id.service.ts                       | 13 +++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/src/app/edit-identity/edit-identity.component.ts 
b/src/app/edit-identity/edit-identity.component.ts
index 9e128bd..d9e011a 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -84,6 +84,10 @@ export class EditIdentityComponent implements OnInit {
     this.loadImportScopesFromLocalStorage()
     this.loadImportIdProviderFromLocalStorage();
     this.importInProgress = true;
+    let oidcState = localStorage.getItem('oidcRequestState');
+    if (oidcState) {
+      this.oidcService.loadState(oidcState);
+    }
     this.activatedRoute.params.subscribe(p => {
       if (p['id'] === undefined) {
         return;
@@ -623,6 +627,7 @@ export class EditIdentityComponent implements OnInit {
     this.attributesToOverwriteOnImport = [];
     localStorage.removeItem('importIdProviderURL');
     localStorage.removeItem('credentialCode');
+    localStorage.removeItem('oidcRequestState');
     localStorage.removeItem('importTargetComponent');
     this.importInProgress = false;
     this.oauthService.logOut();
@@ -653,6 +658,7 @@ export class EditIdentityComponent implements OnInit {
         this.attributesToOverwriteOnImport = [];
         localStorage.removeItem('importIdProviderURL');
         localStorage.removeItem('credentialCode');
+        localStorage.removeItem('oidcRequestState');
         localStorage.removeItem('importTargetComponent');
         this.importInProgress = false;
         this.oauthService.logOut();
@@ -810,6 +816,10 @@ export class EditIdentityComponent implements OnInit {
     this.configureOauthService();
     this.oauthService.logOut(); //Make sure we logout before login
     localStorage.setItem('importTargetComponent', 'edit-identity');
+    /**
+     * Save current openid request state (if any)
+     */
+    localStorage.setItem('oidcRequestState', this.oidcService.getState());
     this.oauthService.loadDiscoveryDocumentAndLogin();
   }
 
diff --git a/src/app/open-id.service.ts b/src/app/open-id.service.ts
index 723397e..50e6466 100644
--- a/src/app/open-id.service.ts
+++ b/src/app/open-id.service.ts
@@ -52,6 +52,19 @@ export class OpenIdService {
     this.inOidcFlow = this.params['redirect_uri'] !== undefined;
   }
 
+  getState() {
+    return JSON.stringify(this.params);
+  }
+
+  loadState(state_string: string) {
+    try {
+      let state = JSON.parse(state_string);
+      this.parseRouteParams(state);
+    } catch(e) {
+      console.log("ERROR: unable to load state " + state_string + " " + e);
+    }
+  }
+
   private buildAuthorizeRedirect(): any {
     var redirectUri = this.config.get().apiUrl + '/openid/authorize';
     redirectUri += '?client_id=' + this.params['client_id'];

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