mcgilman commented on code in PR #10698:
URL: https://github.com/apache/nifi/pull/10698#discussion_r2913461647


##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/service/guard/authentication.guard.ts:
##########
@@ -77,6 +80,13 @@ export const authenticationGuard: CanMatchFn = () => {
                             }),
                             map(() => true),
                             catchError((errorResponse: HttpErrorResponse) => {
+                                if (errorResponse.status === 401) {
+                                    const currentUrl = router.url;
+                                    if (currentUrl && currentUrl !== '/login') 
{
+                                        
storageService.setReturnUrl(currentUrl);
+                                    }
+                                }
+

Review Comment:
   I don't think this change is needed. The auth interceptor will handle the 
401 response when the user is not logged in. That dispatches the 
navigateToLogIn action where the current route is captured.



##########
nifi-frontend/src/main/frontend/apps/nifi/src/app/state/current-user/current-user.effects.ts:
##########
@@ -75,6 +77,10 @@ export class CurrentUserEffects {
             this.actions$.pipe(
                 ofType(UserActions.navigateToLogIn),
                 tap(() => {
+                    const currentUrl = window.location.hash.substring(1) || 
this.router.url;
+                    if (currentUrl && currentUrl !== '/login') {
+                        this.storageService.setReturnUrl(currentUrl);
+                    }

Review Comment:
   When the user logs out they are sent to the logout complete page. From there 
if they click `home` to log back in the user will now be returned to the logout 
complete page following successful authentication. Thinking that maybe that 
could be avoided by updating the condition to ensure it doesn't equal 
`/logout-complete`. I haven't verified this though.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to