db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <rick.hille...@oracle.com>
Subject Re: User authorisation
Date Mon, 23 Apr 2012 12:50:41 GMT
On 4/20/12 4:41 PM, Trejkaz wrote:
> On Sat, Apr 21, 2012 at 1:50 AM, Rick Hillegas<rick.hillegas@oracle.com>  wrote:
>> 3) ...or something else?
> Possibly something else.
> Specifically, the only thing that doesn't really "work" with the way
> we're doing it now is that if you provide valid credentials but can't
> access the database, the error Derby passes back to the user is along
> the lines of "invalid user ID or password. UserAuthenticator only has
> a boolean return value so it isn't possible to pass the reason for
> being rejected using solely a UserAuthenticator.
Hi Trejkaz,

UserAuthenticator.authenticateUser() can throw a SQLException which 
explains that the user doesn't have access to the given database. I find 
that SQLExceptions raised by the following code reach the application:

import java.sql.SQLException;
import java.util.Properties;

import org.apache.derby.authentication.UserAuthenticator;

public class Z implements UserAuthenticator
     public Z() {}

     public boolean authenticateUser
          String userName,
          String userPassword,
          String databaseName,
          Properties info
        throws SQLException
         throw new SQLException( "I can't do that, Dave.", "ZZZZZ" );

Hope this helps,

View raw message