LauraXia123 commented on issue #11682:
URL: https://github.com/apache/gravitino/issues/11682#issuecomment-4787027153

   Based on the analysis of Gravitino's OAuth authentication flow, here is the 
behavior when a logged-in user accesses the login page:
   
   1. Behavior When a Logged-in User Visits /ui/login
   
   No automatic logout; the user is automatically redirected to the inner page.
   
   The key logic resides in the initAuth function in session.js:
   - When a user visits any page, the AuthProvider checks whether a valid token 
exists in localStorage
   - If a valid token is detected, it immediately redirects to the /metalakes 
page (main page)
   - The login page is NOT displayed, and the logout flow is NOT triggered
   
   2. Detailed Flow
   
   User visits /ui/login
       ↓
   session.js initAuth() detects a valid token
       ↓
   Redirect to /metalakes (main page)
   
   Related code locations:
   - /web/web/src/lib/provider/session.js lines 102-105
   - Upon token detection: router.push('/metalakes')
   
   3. Login Failure Handling
   
   If a re-login attempt on the login page fails, the behavior depends on the 
OAuth type:
   
   OIDC Mode:
   - After login failure, redirects to /ui/login?error=<error_message>
   - The user sees the login page with an error parameter
   
   Legacy OAuth Mode:
   - A toast error notification is displayed
   - The user stays on the login page and can retry
   
   4. Important Notes
   
   - /ui/* paths are NOT protected by AuthenticationFilter; the server side 
will not reject access
   - Authentication control is entirely handled by the frontend session.js logic
   - If a token expires but is not detected, API access will return 401, and 
the axios interceptor will clear the token and redirect to the login page
   
   Summary: A logged-in user who directly visits the login page will be 
automatically redirected to the inner page. No logout is triggered, and the 
login interface is not displayed.
   @Octavi00 


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