This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 224964 - Provide support for Proxy Authentication through JPA
Summary: Provide support for Proxy Authentication through JPA
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL: http://wiki.eclipse.org/EclipseLink/D...
Whiteboard: Fixed in 1.0M8
Keywords:
Depends on:
Blocks: 234903
  Show dependency tree
 
Reported: 2008-03-31 14:44 EDT by Doug Clarke CLA
Modified: 2022-06-09 10:26 EDT (History)
1 user (show)

See Also:


Attachments
The first take on Proxy Authentication patch (21.92 KB, patch)
2008-04-24 15:04 EDT, Andrei Ilitchev CLA
no flags Details | Diff
Proxy Authentication Patch - take 2 (25.62 KB, patch)
2008-04-25 16:17 EDT, Andrei Ilitchev CLA
no flags Details | Diff
Proxy Authentication Patch - take 3 (25.76 KB, patch)
2008-04-29 16:57 EDT, Andrei Ilitchev CLA
no flags Details | Diff
Proxy Authentication patch - take 4. (80.13 KB, patch)
2008-05-07 14:45 EDT, Andrei Ilitchev CLA
no flags Details | Diff
Proxy Authentication patch - take 5. Some fixes, improved core tests. (103.25 KB, patch)
2008-05-08 17:35 EDT, Andrei Ilitchev CLA
no flags Details | Diff
The latest patch for proxy authentication (take 6). (360.42 KB, patch)
2008-05-28 13:59 EDT, Andrei Ilitchev CLA
no flags Details | Diff
Checked in patch for proxy authentication (take 7) (361.80 KB, patch)
2008-05-28 17:06 EDT, Andrei Ilitchev CLA
no flags Details | Diff
Additional small patch to be applied on top of the previous one. (8.55 KB, patch)
2008-05-29 16:29 EDT, Andrei Ilitchev CLA
no flags Details | Diff
Additional small testing patch to be applied on top of previous ones. (8.55 KB, patch)
2008-05-30 16:45 EDT, Andrei Ilitchev CLA
no flags Details | Diff
Additional small patch to be applied on top of the previous ones. (9.94 KB, patch)
2008-06-02 13:57 EDT, Andrei Ilitchev CLA
no flags Details | Diff
This patch removes CONNECTION_ECLUSIVE property definition and support. (6.32 KB, patch)
2008-06-03 17:28 EDT, Andrei Ilitchev CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Doug Clarke CLA 2008-03-31 14:44:02 EDT
Usage of ProxyAuthentication with JPA needs to be simplified. 

1. The Proxy properties should be passed in through the EMF.createEntityManager 

2. The connection should be proxied and held as an exclusive connection for the life-cycle of the EntityManager. The EM being closed or GC'd should cause the connection's proxy session to be closed and returned to the data source. May require changes to have the EntitymanagerImpl hold onto its ClientSession.

3. Configuration of ProxyAuthentication needs to be made clear and well documented with examples.
Comment 1 Andrei Ilitchev CLA 2008-04-24 15:04:10 EDT
Created attachment 97508 [details]
The first take on Proxy Authentication patch

The patch implements my posting at http://wiki.eclipse.org/EclipseLink/Development/Oracle/ProxyAuthentication
Not tested yet.
Comment 2 Andrei Ilitchev CLA 2008-04-25 10:46:33 EDT
I found problems with the Proxy Authentication patch: the only case that currently works is ServerSession using External connection pool.
Refactoring the patch.
Comment 3 Andrei Ilitchev CLA 2008-04-25 16:17:07 EDT
Created attachment 97680 [details]
Proxy Authentication Patch - take 2

Fixed the problems of the first patch. Should work with both DatabaseSession and ServerSession (and ClientSessions), both external and internal pools. Still not tested.
Comment 4 Andrei Ilitchev CLA 2008-04-29 16:57:24 EDT
Created attachment 98078 [details]
Proxy Authentication Patch - take 3

Fix in DatasourceAccessor.createCustomizer method.
Comment 5 Andrei Ilitchev CLA 2008-05-07 14:45:58 EDT
Created attachment 99143 [details]
Proxy Authentication patch - take 4.

This patch was tested and works (core tests only, no JPA tests yet).
It contains a new ProxyAuthenticationCustomizerTestModel (under OracleTestModel in the TestingBrowser).
The model requires the same proxy user setup as the old ProxyAuthenticationTestModel.
No exceptions defined yet and "proxytype" is a current property name for specifying proxy type (such as OracleConnection.PROXYTYPE_USER_NAME).
Comment 6 Andrei Ilitchev CLA 2008-05-08 17:35:53 EDT
Created attachment 99386 [details]
Proxy Authentication patch - take 5. Some fixes, improved core tests.
Comment 7 Andrei Ilitchev CLA 2008-05-09 10:08:38 EDT
If you'd like to test the patch make sure to use Oracle jdbc 10.1.0.2 or later.
All you need to do is to pass proxy properties (including proxytype) to either createEMFactory or createEM method, for example:
"proxytype" -> OracleConnection.PROXYTYPE_USER_NAME;
OracleConnection.PROXY_USER_NAME -> "MyProxyUser"
Comment 8 Andrei Ilitchev CLA 2008-05-28 13:59:03 EDT
Created attachment 102452 [details]
The latest patch for proxy authentication (take 6).

The latest fix for proxy authentication, includes both core and jpa tests.
Provides support for Oracle PA using openProxySession (both JPA and core) in all cases (including ExclusiveIsolatedClientSession).
Adds JPA property for specifying ExclusiveIsolatedClientSession (at least one descriptor must be isolated);
Cleans up PropertiesHandler;
EntityManagerProperties reuses names defined in PersistenceUnitPrioperties;
Modifies uow to allow to instantiate ValueHolder when dead;
Uow always released when em.close called (unless there's active trans - then it released when transaction is completed);
RepeatbleWriteUow.release method releases change sets but not the cache.
Usage of ExclusiveIsolatedClientSession should not cause connection leakage (provided that in JTA case the session is released by the user (core case) or em is closed (jpa case);
Modified ExclusiveIsolatedClientSession not to through exception in case it instatiates ValueHolder for Isolated class while already been released - instead the new connection will be acquired and kept just for the duration of the query;
Modified emSetupImpl so that listener passed to createEMF is actually used;
Partially fixed partially worked around "java.lang.OutOfMemoryError: PermGen space" error that shows up in case of open/close the same factory many times, see the big comment in EntityManagerSetupImpl.predeploy method.
Comment 9 Andrei Ilitchev CLA 2008-05-28 15:37:06 EDT
Also the patch removes the old code that supported openProxySession - based ProxyAuthentication, but the old code for OCI-based PA is kept (it's not covered by the new code).

Tests:
core:  OracleModel -> ProxyAuthenticationCustomizerTestModel
jpa: FullRegressionTestSuite -> ProxyAuthenticationTestSuite
Comment 10 Andrei Ilitchev CLA 2008-05-28 17:06:50 EDT
Created attachment 102519 [details]
Checked in patch for proxy authentication (take 7)

This patch was just checked in.
It has some minor fixes compared to the prev. one (uncomment some working code in a test, and remove the obsolete Connector).
Comment 11 Andrei Ilitchev CLA 2008-05-28 17:08:37 EDT
Fixed.
Comment 12 Andrei Ilitchev CLA 2008-05-29 16:29:09 EDT
Created attachment 102744 [details]
Additional small patch to be applied on top of the previous one.

This small patch based on feedback from James and Edwin:
1) Cleaned up some comments in PersistenceUnitProperties and EntityManagerProperties;
2) Moved Oracle-specific JPA tests from FullRegressionTestSuite to the newly created OracleJPATeatSuite.

It should be applied on top of the previous patch.
Comment 13 Andrei Ilitchev CLA 2008-05-30 16:45:41 EDT
Created attachment 102956 [details]
Additional small testing patch to be applied on top of previous ones.
Comment 14 Andrei Ilitchev CLA 2008-06-02 13:57:38 EDT
Created attachment 103163 [details]
Additional small patch to be applied on top of the previous ones.

Checked in a small patch that follows James's suggestion to move create/removeCustomizer into connect/disconnect of DatasourceAccessor.
Comment 15 Andrei Ilitchev CLA 2008-06-03 17:28:25 EDT
Created attachment 103447 [details]
This patch removes CONNECTION_ECLUSIVE property definition and support.

Pending review CONNECTION_EXCLUSIVE property definition and support was removed. The issue will be resolved in a new bug 235433: Can't customize ConnectionPolicy through JPA.
Comment 16 Eclipse Webmaster CLA 2022-06-09 10:26:22 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink