1 package authentication
;
3 import java
.sql
.ResultSet
;
6 public class Authenticator
extends AbstractAuthenticator
{
8 public Credential
[] getEmptyCredentials() throws Exception
10 Credential credentials
[] = new Credential
[3];
11 credentials
[0] = new Credential("Project",false);
12 credentials
[1] = new Credential("User",false);
13 credentials
[2] = new Credential("Password",true);
17 protected boolean checkCredentials(String session_id
, Credential
[] credentials
) throws Exception
{
18 String checkSQL
= "select 1 from user u, project p, user_project up " +
19 "where u.login='"+credentials
[1].getValue()+"' " +
20 "and u.password=md5('"+credentials
[2].getValue()+"') " +
21 "and p.name='"+credentials
[0].getValue()+"' " +
22 "and up.user_id=u.id " +
23 "and up.project_id=p.id";
28 boolean result
= false;
31 sql
= new SQLHelper();
33 rs
= sql
.retrieve(checkSQL
);
34 if (rs
.next()) result
= true;
35 } catch (Exception e
) {
39 if (ex
!= null) throw ex
;