Octavi00 opened a new pull request, #11812:
URL: https://github.com/apache/gravitino/pull/11812

   Web UI support for built-in IdP Basic login [#11682] EPIC
   
   ### What changes were proposed in this pull request?
   - Fix: #11681: Added Basic login functionality following front-end session 
logic as requested + supporting UI modifications.
   
   ### Files Changed + why are the changes needed?
   
   1. 
server-common/src/main/java/org/apache/gravitino/server/authentication/AuthenticationFilter.java
 (Feature)
   -     Adds web login header check to skip the unwanted browser basic auth 
popup
   
   2. web/web/src/app/login/components/BasicLogin.js (New Component)
   - Basic Login Page setup
   - Handles user login input + error catching and message upon invalid 
credentials
   - (Possibly add a more descriptive error message for invalid login?)
   - Prompts UI error popup upon failed login
   
   3. web/web/src/app/login/page.js (Feature)
   - When visited + logged in (confirmed with an access  token) immediately 
redirects to metalakes
   - Replaced if-else logic with switch case to handle different login 
components (oidc, basic, and default)
   
   4. web/web/src/app/page.js (Feature)
   - Replaced empty web page with auto redirect to real main page /metalakes as 
described to be the home page in the issue thread.
   
   5. web/web/src/lib/api/auth/index.js (API Token)
   - Added new 'basicToken'
   - Allows simple token-accept functionalities, mainly 'X-Gravitino-Web-Login' 
which is useful later on for stopping unwanted page refresh upon invalid logins
   
   6. web/web/src/lib/auth/providers/factory.js (Feature)
   - Added new variable 'authenticators' to read from the current config file 
to allow for setting 'providerType' and returning early before unsuitable OAuth 
behaviour, which isn't wanted for Basic Auth
   - Added missing 'this.providerType = providerType' line
   - Added null catch case for provider now that basic doesn't carry one
   - Fixed getProvider type to prevent possible null issues
   
   7. web/web/src/lib/provider/session.js (Feature)
   - Added else-if to redirect user to the metalake (home) page if already 
logged in otherwise forced into the login page.
   
   8. web/web/src/lib/store/auth/index.js (Feature)
   - Added basicLoginAction to replicate loginAction with custom Basic Auth 
logic
   - Added specific variable retention during refresh in authSlice. Prevents 
logout button from disappearing during refresh
   - Added authType to extraReducers for extra security with 'basic' 
functionality (previously only for oauth)
   
   9. web/web/src/lib/utils/axios/index.js (Feature)
   - Added isFullAuthHeader to set tokens relative to Basic Login auth while 
also maintaining jwt flow in the subsequent line
   - Added 'isFailedWebUILoginRequest' to prevent page refresh upon failed 
logins (this is a feature meant for OAuth which should be disabled for basic 
auth)
   - Added catch for 401 API pop-up caused by failed logins
   
   ### Does this PR introduce _any_ user-facing change?
   
   (Please list the user-facing changes introduced by your change, including
     1. Change in user-facing APIs
   - Added new basicLoginApi with basicToken.
   - Contains X-Gravitino-Web-Login
   
          
   ### How was this patch tested?
   
   (Please test your changes, and provide instructions on how to test it:
     1. Enabled basic auth mode using given instructions, and manually tested
     3. Ensured additions didn't cause any new unit test errors
     4. Manually reverted to the default conf file to ensure default behaviours 
unaffected
   


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