[BACKLOG-48179]-Enable browser based authentication for connecting to repository from PDI#10460
[BACKLOG-48179]-Enable browser based authentication for connecting to repository from PDI#10460SahithiKommagani6 wants to merge 1 commit intopentaho:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Enables browser-based (SSO) authentication for connecting to Pentaho Enterprise Repository (PUR) from PDI by capturing a browser session (JSESSIONID), persisting it per server, and reusing it across repository/web-service clients with improved session-expiry detection and retry flows.
Changes:
- Add session/auth infrastructure (
SpoonSessionManager,AuthenticationContext, session strategy + factory) and a local HTTP callback flow (BrowserAuthenticationService) to capture JSESSIONID via the user’s browser. - Integrate browser-auth and session-expiry recovery into repository connection UI flows and PUR web-service clients (cookie-based auth, retries, reconnect UX).
- Add/extend tests across UI and plugin modules for auth/session behaviors and the new helper utilities.
Reviewed changes
Copilot reviewed 50 out of 50 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/test/java/org/pentaho/di/ui/spoon/session/SpoonSessionManagerTest.java | Tests singleton + per-server auth-context caching and default-port keying. |
| ui/src/test/java/org/pentaho/di/ui/spoon/session/SessionBasedAuthStrategyTest.java | Tests session credential storage/lookup, markers, and keying. |
| ui/src/test/java/org/pentaho/di/ui/spoon/session/AuthenticationStrategyFactoryTest.java | Tests strategy registry, normalization, and defaults. |
| ui/src/test/java/org/pentaho/di/ui/repository/repositoryexplorer/controllers/MainControllerTest.java | Tests session-expiry routing logic in repository explorer controller. |
| ui/src/test/java/org/pentaho/di/ui/repository/repositoryexplorer/controllers/LazilyInitializedControllerTest.java | Tests lazy-init behavior with session-expiry handling and retry/UX paths. |
| ui/src/test/java/org/pentaho/di/ui/repository/exception/RepositoryExceptionUtilsTest.java | Tests centralized session-expiry detection heuristics and recursion guards. |
| ui/src/test/java/org/pentaho/di/ui/repo/service/BrowserAuthenticationServiceTest.java | Tests callback server/browser-auth flow, parsing, and error handling. |
| ui/src/main/java/org/pentaho/di/ui/spoon/session/SpoonSessionManager.java | Singleton manager for per-server AuthenticationContext caching. |
| ui/src/main/java/org/pentaho/di/ui/spoon/session/SessionBasedAuthStrategy.java | Stores JSESSIONID + marker per server (strategy implementation). |
| ui/src/main/java/org/pentaho/di/ui/spoon/session/AuthenticationStrategyFactory.java | Registry/factory for authentication strategies (default SESSION). |
| ui/src/main/java/org/pentaho/di/ui/spoon/session/AuthenticationStrategy.java | Strategy interface for auth implementations. |
| ui/src/main/java/org/pentaho/di/ui/spoon/session/AuthenticationContext.java | High-level API for auth ops + session validation/cleanup helpers. |
| ui/src/main/java/org/pentaho/di/ui/spoon/dialog/SaveProgressDialog.java | Adds repository directory recovery attempt before saving after reconnect. |
| ui/src/main/java/org/pentaho/di/ui/spoon/delegates/SpoonDBDelegate.java | Hardens variable initialization and adds DB dialog reset hook for recovery. |
| ui/src/main/java/org/pentaho/di/ui/repository/repositoryexplorer/controllers/SecurityController.java | Refactors lost-repo handling to retry initialization after session recovery. |
| ui/src/main/java/org/pentaho/di/ui/repository/repositoryexplorer/controllers/MainController.java | Adds session-expiry handling path (relogin + retry) and centralized detection. |
| ui/src/main/java/org/pentaho/di/ui/repository/repositoryexplorer/controllers/LazilyInitializedController.java | Adds session-expiry detection and delegation to MainController. |
| ui/src/main/java/org/pentaho/di/ui/repository/exception/RepositoryExceptionUtils.java | New utility to detect session-expiry/auth-failure across exception types/causes. |
| ui/src/main/java/org/pentaho/di/ui/repository/controllers/RepositoriesController.java | Adds browser-auth login flow for PUR SSO repos (via callback service). |
| ui/src/main/java/org/pentaho/di/ui/repository/RepositorySecurityUI.java | Avoids showing security error dialog for session-expiry exceptions. |
| ui/src/main/java/org/pentaho/di/ui/repository/RepositoriesHelper.java | Connect path recognizes the session-auth password marker. |
| ui/src/main/java/org/pentaho/di/ui/repo/service/BrowserAuthenticationService.java | Implements browser open + local HTTP callback server capturing session info. |
| plugins/repositories/core/src/test/java/org/pentaho/di/ui/repo/util/PurRepositoryUtilsTest.java | Tests new PUR utility functions (type checks + URL extraction). |
| plugins/repositories/core/src/test/java/org/pentaho/di/ui/repo/timeout/SessionTimeoutHandlerTest.java | Extends timeout handler tests for session-expiry UX paths. |
| plugins/repositories/core/src/test/java/org/pentaho/di/ui/repo/menu/RepositoryConnectMenuTest.java | Tests SSO branch selection and callback-driven repository connect flow. |
| plugins/repositories/core/src/main/java/org/pentaho/di/ui/repo/util/PurRepositoryUtils.java | New helper for PUR identification + reflection-based server URL extraction. |
| plugins/repositories/core/src/main/java/org/pentaho/di/ui/repo/timeout/SessionTimeoutHandler.java | Adds session-expiry reconnect UX + optional browser re-auth before fallback login. |
| plugins/repositories/core/src/main/java/org/pentaho/di/ui/repo/timeout/RepositorySessionTimeoutHandler.java | Adds explicit session-expiry interception and reconnect-with-retry logic. |
| plugins/repositories/core/src/main/java/org/pentaho/di/ui/repo/menu/RepositoryConnectMenu.java | Adds auth-method-based connect (SSO vs username/password) and browser-auth flow. |
| plugins/repositories/core/src/main/java/org/pentaho/di/ui/repo/dialog/RepositoryManagerDialog.java | Adds context menu + connect logic for browser login where supported. |
| plugins/repositories/core/src/main/java/org/pentaho/di/ui/repo/dialog/PentahoEnterpriseRepoFormComposite.java | Adds UI to configure auth method (SSO vs username/password) in repo metadata. |
| plugins/repositories/core/src/main/java/org/pentaho/di/ui/repo/controller/RepositoryConnectController.java | Adjusts reconnect behavior to avoid prompts/closures during relogin. |
| plugins/pur/core/src/test/java/org/pentaho/di/repository/pur/PurRepositoryMetaTest.java | Adds coverage for new authMethod persistence/serialization. |
| plugins/pur/core/src/test/java/org/pentaho/di/repository/pur/PurRepositoryConnectorTest.java | Adds coverage for session-auth connect behavior using stored JSESSIONID. |
| plugins/pur/core/src/test/java/com/pentaho/di/purge/RepositoryCleanupUtilTest.java | Adds coverage for session-auth HTTP client setup via JSESSIONID cookie. |
| plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/WebServiceManager.java | Adds cookie-based auth (JSESSIONID) for SOAP/REST clients when available. |
| plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/UserRoleDelegate.java | Uses cookie auth when available for managed/unmanaged checks. |
| plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/UnifiedRepositoryInvocationHandler.java | Prioritizes auth/session-expiry detection and throws auth exception early. |
| plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepositoryMeta.java | Adds authMethod field persisted to XML/JSON and populated from UI properties. |
| plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepositoryConnector.java | Adds session-auth branch: uses stored JSESSIONID, avoids password decrypt, skips username fetch. |
| plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java | Re-throws KettleAuthenticationException to preserve session-expiry signaling. |
| plugins/pur/core/src/main/java/com/pentaho/di/purge/RepositoryCleanupUtil.java | Adds session-auth support by registering a cookie request filter when enabled. |
| plugins/engine-configuration/impl/src/test/java/org/pentaho/di/engine/ui/RunConfigurationDelegateTest.java | Adds tests for session-expiry retry handling in run configuration operations. |
| plugins/engine-configuration/impl/src/main/java/org/pentaho/di/engine/ui/RunConfigurationPopupMenuExtension.java | Routes actions through session-aware loadAnd* helpers. |
| plugins/engine-configuration/impl/src/main/java/org/pentaho/di/engine/ui/RunConfigurationDelegate.java | Adds generic “execute with session retry” wrapper + session-expiry UI handling. |
| plugins/engine-configuration/impl/src/main/java/org/pentaho/di/engine/configuration/impl/pentaho/scheduler/SchedulerRequest.java | Adds cookie-based session auth header for scheduler requests when applicable. |
Comments suppressed due to low confidence (1)
plugins/engine-configuration/impl/src/main/java/org/pentaho/di/engine/configuration/impl/pentaho/scheduler/SchedulerRequest.java:100
isSessionAuthis treated as true when the repository password is null/empty. That can result in sending neither a session cookie nor a Basic auth header (and silently continuing), changing behavior for cases where an empty password is valid/expected or where basic auth should still be attempted. Consider restricting session-auth behavior to the explicitSESSION_AUTH_PASSWORDmarker and otherwise falling back to Basic auth only when both username and password are present.
boolean isSessionAuth = AuthenticationContext.SESSION_AUTH_PASSWORD.equals( password )
|| ( password == null || password.isEmpty() );
if ( isSessionAuth ) {
try {
AuthenticationContext authContext =
SpoonSessionManager.getInstance().getAuthenticationContext( baseUrl );
String jsessionId = authContext.getJSessionId();
if ( jsessionId != null && !jsessionId.trim().isEmpty() ) {
httpPost.setHeader( "Cookie", "JSESSIONID=" + jsessionId );
}
} catch ( Exception e ) {
LogChannel.GENERAL.logError( "Error setting session auth header", e );
}
} else if ( username != null ) {
byte[] encoding;
try {
String userPass = username + ":" + password;
encoding = Base64.getEncoder().encode( userPass.getBytes( UTF_8 ) );
httpPost.setHeader( AUTHORIZATION, "Basic " + new String( encoding ) );
} catch ( UnsupportedEncodingException e ) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ui/src/main/java/org/pentaho/di/ui/spoon/session/AuthenticationContext.java
Outdated
Show resolved
Hide resolved
plugins/repositories/core/src/main/java/org/pentaho/di/ui/repo/menu/RepositoryConnectMenu.java
Outdated
Show resolved
Hide resolved
ui/src/main/java/org/pentaho/di/ui/repo/service/BrowserAuthenticationService.java
Show resolved
Hide resolved
ui/src/main/java/org/pentaho/di/ui/repo/service/BrowserAuthenticationService.java
Outdated
Show resolved
Hide resolved
ui/src/main/java/org/pentaho/di/ui/spoon/session/SessionBasedAuthStrategy.java
Show resolved
Hide resolved
ui/src/main/java/org/pentaho/di/ui/spoon/session/SessionBasedAuthStrategy.java
Show resolved
Hide resolved
ui/src/main/java/org/pentaho/di/ui/spoon/session/AuthenticationContext.java
Show resolved
Hide resolved
plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepositoryMeta.java
Show resolved
Hide resolved
ui/src/main/java/org/pentaho/di/ui/spoon/session/SessionBasedAuthStrategy.java
Show resolved
Hide resolved
5ccb70d to
4d761d0
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 50 out of 50 changed files in this pull request and generated 11 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ui/src/main/java/org/pentaho/di/ui/repository/controllers/RepositoriesController.java
Show resolved
Hide resolved
ui/src/main/java/org/pentaho/di/ui/spoon/session/AuthenticationContext.java
Show resolved
Hide resolved
ui/src/main/java/org/pentaho/di/ui/repository/exception/RepositoryExceptionUtils.java
Outdated
Show resolved
Hide resolved
...s/repositories/core/src/main/java/org/pentaho/di/ui/repo/dialog/RepositoryManagerDialog.java
Outdated
Show resolved
Hide resolved
ui/src/test/java/org/pentaho/di/ui/repo/service/BrowserAuthenticationServiceTest.java
Outdated
Show resolved
Hide resolved
ui/src/main/java/org/pentaho/di/ui/repo/service/BrowserAuthenticationService.java
Outdated
Show resolved
Hide resolved
ui/src/main/java/org/pentaho/di/ui/repo/service/BrowserAuthenticationService.java
Outdated
Show resolved
Hide resolved
...pur/core/src/main/java/org/pentaho/di/repository/pur/UnifiedRepositoryInvocationHandler.java
Outdated
Show resolved
Hide resolved
...s/repositories/core/src/main/java/org/pentaho/di/ui/repo/dialog/RepositoryManagerDialog.java
Show resolved
Hide resolved
...epositories/core/src/test/java/org/pentaho/di/ui/repo/timeout/SessionTimeoutHandlerTest.java
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
4d761d0 to
c4aff4e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
c4aff4e to
a10ad7b
Compare
This comment has been minimized.
This comment has been minimized.
a10ad7b to
76e8307
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
… repository from PDI
76e8307 to
59f5356
Compare
📦 Vulnerable Dependencies✍️ Summary
🔬 Research Details[ CVE-2016-6814 ] org.codehaus.groovy:groovy 1.8.9Description: [ CVE-2015-3253 ] org.codehaus.groovy:groovy 1.8.9Description: [ CVE-2025-66168 ] org.apache.activemq:activemq-mqtt 5.18.7Description: This issue affects Apache ActiveMQ: before 5.19.2, 6.0.0 to 6.1.8, and 6.2.0 Users are recommended to upgrade to version 5.19.2, 6.1.9, or 6.2.1, which fixes the issue. Note:Frogbot also supports Contextual Analysis, Secret Detection, IaC and SAST Vulnerabilities Scanning. This features are included as part of the JFrog Advanced Security package, which isn't enabled on your system. |
❌ Build failed in 1h 6m 55sBuild command: mvn clean verify -B -e -Daudit -Djs.no.sandbox -pl \
plugins/engine-configuration/impl,plugins/pur/core,plugins/repositories/core,ui⛔ Failed Tests⛈️ 2 test(s) failed:org.pentaho.di.ui.repo.menu.RepositoryConnectMenuTest.testOpenBrowserLogin_Timeout_ShowsTimeoutMessage (click to expand)
org.pentaho.di.ui.repo.menu.RepositoryConnectMenuTest.testOpenBrowserLogin_AuthFails_ShowsError (click to expand)
Tests run: 1056, Failures: 2, Skipped: 1 Test Results ℹ️ This is an automatic message |




BACKLOG-48179-Enable browser based authentication for connecting to repository from PDI