Public Member Functions | |
PasswordAuthenticator (String username, String password) | |
Subject | authenticate (Object credentials) throws SecurityException |
Static Public Member Functions | |
Object | createCredentials (String username, String password) |
Static Public Attributes | |
final PasswordAuthenticator | NO_AUTHENICATION |
Static Package Attributes | |
Trace | logger |
Definition at line 38 of file PasswordAuthenticator.java.
|
Creates a new
Definition at line 61 of file PasswordAuthenticator.java. 00062 { 00063 this.username = username; 00064 this.password = password; 00065 }
|
|
Definition at line 82 of file PasswordAuthenticator.java. 00083 { 00084 try 00085 { 00086 if (username == null && password == null) 00087 { 00088 // no authentication is required we return 00089 return new Subject(); 00090 } 00091 00092 if (credentials == null) 00093 { 00094 throw new SecurityException("credentials are required"); 00095 } 00096 00097 try 00098 { 00099 String[] credentialsArray = (String[]) credentials; 00100 if (username.equals(credentialsArray[0]) 00101 && password.equals(credentialsArray[1])) 00102 { 00103 // username and password are ok 00104 if (logger.isDebugEnabled()) 00105 { 00106 logger.debug("successfully authenitcated "); 00107 } 00108 return new Subject(); 00109 } 00110 } 00111 catch (Exception e) 00112 { 00113 // the credentials object makes problems, is was probably not created 00114 // with the createCredentials method 00115 throw new SecurityException("problems with credentials object : " 00116 + e.getMessage()); 00117 } 00118 00119 // username and password do not match 00120 throw new SecurityException("invalid credentials"); 00121 } 00122 catch (SecurityException e) 00123 { 00124 logger.error(e.getMessage()); 00125 try 00126 { 00127 String clientId = java.rmi.server.RemoteServer.getClientHost(); 00128 logger.warn("refused unauthorized access for client " + clientId); 00129 } 00130 catch (Exception ex) 00131 { 00132 00133 } 00134 throw e; 00135 } 00136 }
|
|
create a credentials object with the supplied username and password
Definition at line 74 of file PasswordAuthenticator.java. 00075 { 00076 return new String[]{username, password}; 00077 }
|
|
Initial value: Trace
.getLogger("org.objectweb.cjdbc.controller.authentication")
Definition at line 49 of file PasswordAuthenticator.java. |
|
Initial value: new PasswordAuthenticator( null, null) Definition at line 46 of file PasswordAuthenticator.java. |