[ 
https://issues.apache.org/jira/browse/DERBY-5397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13096769#comment-13096769
 ] 

Trejkaz commented on DERBY-5397:
--------------------------------

For instance, I would like to use a UserAuthenticator like this:

    public class UserAuthenticator {
       private final UserStore store;

       public UserAuthenticator(UserStore store) {
          this.store = store;
       }

       public void authenticateUser(String user, String pass, String db, 
Properties info) {
          // ... use the store
       }
    }

But Derby calls a no-arg constructor to construct the authenticator itself, so 
there is no way to do it.


> Make it possible to directly set a UserAuthenticator instance on the 
> NetworkServerControl.
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5397
>                 URL: https://issues.apache.org/jira/browse/DERBY-5397
>             Project: Derby
>          Issue Type: Improvement
>          Components: Network Server
>            Reporter: Trejkaz
>              Labels: auth
>
> We are using NetworkServerControl to embed the Derby server.  We would like 
> to use our own user authenticator for this.  Currently, this requires setting 
> a system property and Derby creates a brand new instance every time it needs 
> to call it.
> This wreaks havoc with our development philosophy because we would like to 
> unit test our stuff, but Derby is constructing an instance directly instead 
> of letting us pass a mock authenticator.
> The workaround we are using is:
> * Set the real authenticator as a static field somewhere and provide 
> register()/deregister()/lookup() access methods
> * Make a DelegatingUserAuthenticator which calls lookup() on the real thing 
> and then delegates the call to it

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to