aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/app')
-rw-r--r--src/app/edit-identity/edit-identity.component.ts10
-rw-r--r--src/app/open-id.service.ts13
2 files changed, 23 insertions, 0 deletions
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 {
84 this.loadImportScopesFromLocalStorage() 84 this.loadImportScopesFromLocalStorage()
85 this.loadImportIdProviderFromLocalStorage(); 85 this.loadImportIdProviderFromLocalStorage();
86 this.importInProgress = true; 86 this.importInProgress = true;
87 let oidcState = localStorage.getItem('oidcRequestState');
88 if (oidcState) {
89 this.oidcService.loadState(oidcState);
90 }
87 this.activatedRoute.params.subscribe(p => { 91 this.activatedRoute.params.subscribe(p => {
88 if (p['id'] === undefined) { 92 if (p['id'] === undefined) {
89 return; 93 return;
@@ -623,6 +627,7 @@ export class EditIdentityComponent implements OnInit {
623 this.attributesToOverwriteOnImport = []; 627 this.attributesToOverwriteOnImport = [];
624 localStorage.removeItem('importIdProviderURL'); 628 localStorage.removeItem('importIdProviderURL');
625 localStorage.removeItem('credentialCode'); 629 localStorage.removeItem('credentialCode');
630 localStorage.removeItem('oidcRequestState');
626 localStorage.removeItem('importTargetComponent'); 631 localStorage.removeItem('importTargetComponent');
627 this.importInProgress = false; 632 this.importInProgress = false;
628 this.oauthService.logOut(); 633 this.oauthService.logOut();
@@ -653,6 +658,7 @@ export class EditIdentityComponent implements OnInit {
653 this.attributesToOverwriteOnImport = []; 658 this.attributesToOverwriteOnImport = [];
654 localStorage.removeItem('importIdProviderURL'); 659 localStorage.removeItem('importIdProviderURL');
655 localStorage.removeItem('credentialCode'); 660 localStorage.removeItem('credentialCode');
661 localStorage.removeItem('oidcRequestState');
656 localStorage.removeItem('importTargetComponent'); 662 localStorage.removeItem('importTargetComponent');
657 this.importInProgress = false; 663 this.importInProgress = false;
658 this.oauthService.logOut(); 664 this.oauthService.logOut();
@@ -810,6 +816,10 @@ export class EditIdentityComponent implements OnInit {
810 this.configureOauthService(); 816 this.configureOauthService();
811 this.oauthService.logOut(); //Make sure we logout before login 817 this.oauthService.logOut(); //Make sure we logout before login
812 localStorage.setItem('importTargetComponent', 'edit-identity'); 818 localStorage.setItem('importTargetComponent', 'edit-identity');
819 /**
820 * Save current openid request state (if any)
821 */
822 localStorage.setItem('oidcRequestState', this.oidcService.getState());
813 this.oauthService.loadDiscoveryDocumentAndLogin(); 823 this.oauthService.loadDiscoveryDocumentAndLogin();
814 } 824 }
815 825
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 {
52 this.inOidcFlow = this.params['redirect_uri'] !== undefined; 52 this.inOidcFlow = this.params['redirect_uri'] !== undefined;
53 } 53 }
54 54
55 getState() {
56 return JSON.stringify(this.params);
57 }
58
59 loadState(state_string: string) {
60 try {
61 let state = JSON.parse(state_string);
62 this.parseRouteParams(state);
63 } catch(e) {
64 console.log("ERROR: unable to load state " + state_string + " " + e);
65 }
66 }
67
55 private buildAuthorizeRedirect(): any { 68 private buildAuthorizeRedirect(): any {
56 var redirectUri = this.config.get().apiUrl + '/openid/authorize'; 69 var redirectUri = this.config.get().apiUrl + '/openid/authorize';
57 redirectUri += '?client_id=' + this.params['client_id']; 70 redirectUri += '?client_id=' + this.params['client_id'];