This is an automated email from the ASF dual-hosted git repository.

thenatog pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new 6bfc798515 NIFI-10350 Corrected Registry User Authorization for OIDC
6bfc798515 is described below

commit 6bfc798515635fcf3ea2ba6e2ad29e8383556901
Author: exceptionfactory <[email protected]>
AuthorDate: Thu Aug 11 15:03:13 2022 -0500

    NIFI-10350 Corrected Registry User Authorization for OIDC
    
    - Moved refresh of Registry Configuration to checkLogin functions
    - Refreshing Registry Configuration allows the user interface to reflect 
the correct status for OIDC and other authentication strategies
    
    Signed-off-by: Nathan Gough <[email protected]>
    
    This closes #6295.
---
 .../login/dialogs/nf-registry-user-login.js          | 10 +++-------
 .../services/nf-registry.auth-guard.service.js       | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git 
a/nifi-registry/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/components/login/dialogs/nf-registry-user-login.js
 
b/nifi-registry/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/components/login/dialogs/nf-registry-user-login.js
index 29b947529b..043937b646 100644
--- 
a/nifi-registry/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/components/login/dialogs/nf-registry-user-login.js
+++ 
b/nifi-registry/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/components/login/dialogs/nf-registry-user-login.js
@@ -56,13 +56,9 @@ NfRegistryUserLogin.prototype = {
         var self = this;
         this.nfRegistryApi.postToLogin(username.value, 
password.value).subscribe(function (response) {
             if (response || response.status === 200) {
-                //successful login update registry config
-                self.nfRegistryApi.getRegistryConfig().subscribe(function 
(registryConfig) {
-                    self.nfRegistryService.registry.config = registryConfig;
-                    self.nfRegistryService.currentUser.anonymous = false;
-                    self.dialogRef.close();
-                    
self.nfRegistryLoginAuthGuard.checkLogin(self.nfRegistryService.redirectUrl);
-                });
+                self.nfRegistryService.currentUser.anonymous = false;
+                self.dialogRef.close();
+                
self.nfRegistryLoginAuthGuard.checkLogin(self.nfRegistryService.redirectUrl);
             }
         });
     },
diff --git 
a/nifi-registry/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/services/nf-registry.auth-guard.service.js
 
b/nifi-registry/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/services/nf-registry.auth-guard.service.js
index 4300835020..962e181ae6 100644
--- 
a/nifi-registry/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/services/nf-registry.auth-guard.service.js
+++ 
b/nifi-registry/nifi-registry-core/nifi-registry-web-ui/src/main/webapp/services/nf-registry.auth-guard.service.js
@@ -78,6 +78,11 @@ NfRegistryUsersAdministrationAuthGuard.prototype = {
                             // render the logout button if there is a token 
locally
                             if (self.nfStorage.getItem('jwt') !== null) {
                                 self.nfRegistryService.currentUser.canLogout = 
true;
+
+                                // Update Registry Configuration following 
successful login
+                                
self.nfRegistryApi.getRegistryConfig().subscribe(function (registryConfig) {
+                                    self.nfRegistryService.registry.config = 
registryConfig;
+                                });
                             }
 
                             // redirect to explorer perspective if not admin
@@ -201,6 +206,11 @@ NfRegistryWorkflowsAdministrationAuthGuard.prototype = {
                             // render the logout button if there is a token 
locally
                             if (self.nfStorage.getItem('jwt') !== null) {
                                 self.nfRegistryService.currentUser.canLogout = 
true;
+
+                                // Update Registry Configuration following 
successful login
+                                
self.nfRegistryApi.getRegistryConfig().subscribe(function (registryConfig) {
+                                    self.nfRegistryService.registry.config = 
registryConfig;
+                                });
                             }
 
                             // redirect to explorer perspective if not admin
@@ -303,6 +313,11 @@ NfRegistryLoginAuthGuard.prototype = {
                         // render the logout button if there is a token locally
                         if (self.nfStorage.getItem('jwt') !== null) {
                             self.nfRegistryService.currentUser.canLogout = 
true;
+
+                            // Update Registry Configuration following 
successful login
+                            
self.nfRegistryApi.getRegistryConfig().subscribe(function (registryConfig) {
+                                self.nfRegistryService.registry.config = 
registryConfig;
+                            });
                         }
                         
self.nfRegistryService.currentUser.canActivateResourcesAuthGuard = true;
                         resolve(false);
@@ -382,6 +397,11 @@ NfRegistryResourcesAuthGuard.prototype = {
                             if (self.nfStorage.hasItem('jwt')) {
                                 self.nfRegistryService.currentUser.canLogout = 
true;
                                 
self.nfRegistryService.currentUser.canActivateResourcesAuthGuard = true;
+
+                                // Update Registry Configuration following 
successful login
+                                
self.nfRegistryApi.getRegistryConfig().subscribe(function (registryConfig) {
+                                    self.nfRegistryService.registry.config = 
registryConfig;
+                                });
                                 resolve(true);
                             } else {
                                 self.router.navigateByUrl('login');

Reply via email to