Authentificating users from Java

Hello,

I wrote a java program for users authentication to tamino database.
The steps followed were:

1.-set the property authentication equal “tamino” database

2.-create a user.

The problem:

1.- when login with an incorrect user and password the program return an exception

result (Ok)

2- when login a correct user and password the program sign to tamino.

result (Ok)

3.- logout (no connections)

4.- when login with an incorrect user and password the program return an exception

result (nOk)

because the user and password doesn’t exist in the tamino database.

the source code is:

private boolean isAuthentified(String _strUser, String _strPassword) throws Exception{
boolean booAuthentified = true;
try{
TConnectionFactory tconFactory = TConnectionFactory.getInstance();
TConnection connection = tconFactory.newConnection
(“http://localhost/tamino/xml”, _strUser, _strPassword );
}catch(TException eConnection){
booAuthentified = false;
}finally{
if (connection != null){ connection.close();
connection = null;
}
}
return booAuthentified;
}

It seems that what is happening is that Tamino authenticates all the users that follow a valid user authentication. For example if you entry a non valid user Tamino will reject it until you sign in with a valid user. From that point you can keep signing-in even if the user is not correct. does anyone know how to solve it?

thanks in advance

This code should not compile - you are referencing your TConnection, “connection”, outside its scope. It is only available inside the try block in which it is defined. Did you change your code?

Hi,

The source code that i posted was just a single o too many methods of a class. For purposes of simplicity I am not posting the whole class and not even the project. If you think you may need it I can share the whole project.

thanks in advance

Hello,

I would like to clarify some questions which would help me in answering you.

  1. Do say the following code snippet would return true for both the requests:
    public static void main(String args[]) throws Exception{
    boolean ans = new TestAuthentication().isAuthentified(“test\test”, “test”);
    System.out.println("ans: " + ans);
    ans = new TestAuthentication().isAuthentified(“test\test”, “test1”);
    System.out.println("ans: " + ans);
    }

  2. Could you please let me know, the Tamino \ TAJ Version used by you.

Thanks,

Abhijeet