Changeset 6424
- Timestamp:
- Feb 25, 2014, 2:37:04 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/config/dist/base.config
r6351 r6424 62 62 # ====================== 63 63 64 # ---------------- 65 # POP3 mail server 66 # ---------------- 67 #auth.driver = net.sf.basedb.core.authentication.POP3Authenticator 68 #auth.jarpath = 69 #auth.init = mail.example.com 64 # If extra information such as address, email, phone, etc. should 65 # be synchronized or not from external authentication managers 70 66 #auth.synchronize = 0 67 68 # If passwords should be cached locally or not to allow 69 # fallback to internal authentication when external authentication 70 # system is not responding 71 71 #auth.cachepasswords = 0 72 73 # Number of days to cache passwords locally 72 74 #auth.daystocache = 0 73 75 -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/Agent.java
r6268 r6424 52 52 import net.sf.basedb.core.Project; 53 53 import net.sf.basedb.core.SessionControl; 54 54 import net.sf.basedb.core.authentication.LoginRequest; 55 55 import net.sf.basedb.util.SocketUtil; 56 56 import net.sf.basedb.util.Values; … … 892 892 { 893 893 log.info("Logging in as user: " + login); 894 sc.login(login, password, "Job agent running on host " + getServerName()); 894 LoginRequest loginRequest = new LoginRequest(login, password); 895 loginRequest.setComment("Job agent running on host " + getServerName()); 896 sc.login(loginRequest); 895 897 } 896 898 return sc; -
trunk/src/clients/jobagent/net/sf/basedb/clients/jobagent/executors/ThreadJobExecutor.java
r6127 r6424 36 36 import net.sf.basedb.core.Project; 37 37 import net.sf.basedb.core.SessionControl; 38 import net.sf.basedb.core.authentication.LoginRequest; 38 39 import net.sf.basedb.core.plugin.Response; 39 40 import net.sf.basedb.core.signal.SignalReceiver; … … 177 178 sc = Application.newSessionControl("net.sf.basedb.clients.jobagent", 178 179 SocketUtil.getLocalHost().toString(), null); 179 sc.login(login, password, loginComment); 180 LoginRequest loginRequest = new LoginRequest(login, password); 181 loginRequest.setComment(loginComment); 182 sc.login(loginRequest); 180 183 dc = sc.newDbControl(); 181 184 Job job = Job.getById(dc, jobId); -
trunk/src/core/core-extensions.xml
r6423 r6424 247 247 </action-factory> 248 248 </extension> 249 250 <extension 251 id="net.sf.basedb.core.authentication.old-auth-manager" 252 extends="net.sf.basedb.core.authentication-manager" 253 > 254 <about> 255 <name>Old authentication manager</name> 256 <description> 257 Wrapper implementation for supporting the old external 258 authentication style. The implemention is only enabled if 259 the 'auth.driver' settings exists in 'base.config'. 260 </description> 261 </about> 262 <index>999</index> 263 <action-factory> 264 <factory-class>net.sf.basedb.core.authentication.OldAuthenticationWrapperFactory</factory-class> 265 </action-factory> 266 </extension> 249 267 250 268 <!-- -
trunk/src/core/net/sf/basedb/core/Install.java
r6358 r6424 25 25 package net.sf.basedb.core; 26 26 27 import net.sf.basedb.core.authentication.LoginRequest; 27 28 import net.sf.basedb.core.data.BioPlateEventTypeData; 28 29 import net.sf.basedb.core.data.BioPlateTypeData; … … 64 65 import net.sf.basedb.core.data.PluginTypeData; 65 66 import net.sf.basedb.core.hibernate.SchemaGenerator; 66 67 67 import net.sf.basedb.core.SessionControl; 68 68 import net.sf.basedb.core.DbControl; 69 70 69 import net.sf.basedb.util.FileUtil; 71 70 import net.sf.basedb.util.Values; … … 227 226 // Now that we have a root user let's create a session 228 227 sessionControl = Application.newSessionControl( null, null, null ); 229 sessionControl.login(rootLogin, rootPassword, "InitDBSessionId"); 228 LoginRequest loginRequest = new LoginRequest(rootLogin, rootPassword); 229 loginRequest.setComment("InitDBSessionId"); 230 sessionControl.login(loginRequest); 230 231 231 232 progressStep++; -
trunk/src/core/net/sf/basedb/core/PluginSessionControl.java
r6127 r6424 64 64 */ 65 65 @Override 66 @Deprecated 66 67 public synchronized void login(String login, String password, String comment) 67 68 throws ItemNotFoundException, PermissionDeniedException, InvalidPasswordException, BaseException -
trunk/src/core/net/sf/basedb/core/SessionControl.java
r6423 r6424 430 430 if (userData == null) 431 431 { 432 throw new ItemNotFoundException(" User[login="+login+"]");432 throw new ItemNotFoundException("The user with login '" + login + "' is not known to BASE."); 433 433 } 434 434 if (userData.isRemoved()) 435 435 { 436 throw new PermissionDeniedException("The account has been flagged for deletion: User[login="+login+"]");436 throw new PermissionDeniedException("The user with login '" + login + "' is flagged for deletion."); 437 437 } 438 438 if (userData.isDisabled()) 439 439 { 440 throw new PermissionDeniedException("The account has been disabled: User[login="+login+"]");440 throw new PermissionDeniedException("The user with login '" + login + "' is disabled."); 441 441 } 442 442 Date expirationDate = userData.getExpirationDate(); … … 450 450 if (cryptedPassword == null || !User.checkPassword(password, cryptedPassword)) 451 451 { 452 throw new InvalidPasswordException(" User[login="+login+"]");452 throw new InvalidPasswordException("The password for login '" + login + "' is not correct."); 453 453 } 454 454 … … 491 491 catch (net.sf.basedb.core.authentication.UnknownLoginException ex) 492 492 { 493 throw new ItemNotFoundException(" User[login="+loginRequest.getLogin()+"]", ex);493 throw new ItemNotFoundException("The user with login '" + loginRequest.getLogin() + "' is not known to BASE.", ex); 494 494 } 495 495 catch (net.sf.basedb.core.authentication.InvalidPasswordException ex) 496 496 { 497 throw new InvalidPasswordException(" User[login="+loginRequest.getLogin()+"]", ex);497 throw new InvalidPasswordException("The password for login '" + loginRequest.getLogin() + "' is not correct.", ex); 498 498 } 499 499 catch (net.sf.basedb.core.authentication.AuthenticationException ex) … … 508 508 if (info == null) return null; 509 509 510 // Load user information, first try 'id' and then 'login' 510 511 UserData userData = context.getUserByExternalId(info.id); 512 if (userData == null) 513 { 514 userData = context.getUserByLogin(info.login); 515 } 511 516 if (userData == null) 512 517 { -
trunk/src/core/net/sf/basedb/core/Update.java
r6390 r6424 45 45 46 46 47 48 import net.sf.basedb.core.authentication.LoginRequest; 47 49 import net.sf.basedb.core.data.AnnotatableData; 48 50 import net.sf.basedb.core.data.AnnotationSetData; … … 241 243 // Test root user account 242 244 SessionControl sc = Application.newSessionControl(null, null, null); 243 sc.login(rootLogin, rootPassword, null); 245 LoginRequest loginRequest = new LoginRequest(rootLogin, rootPassword); 246 sc.login(loginRequest); 244 247 if (sc.getLoggedInUserId() != SystemItems.getId(User.ROOT)) 245 248 { … … 522 525 // Test root user account 523 526 SessionControl sc = Application.newSessionControl(null, null, null); 524 sc.login(rootLogin, rootPassword, null); 527 LoginRequest loginRequest = new LoginRequest(rootLogin, rootPassword); 528 sc.login(loginRequest); 525 529 if (sc.getLoggedInUserId() != SystemItems.getId(User.ROOT)) 526 530 { … … 1059 1063 // Test root user account 1060 1064 SessionControl sc = Application.newSessionControl(null, null, null); 1061 sc.login(rootLogin, rootPassword, "Upgrading to BASE 3"); 1065 LoginRequest loginRequest = new LoginRequest(rootLogin, rootPassword); 1066 loginRequest.setComment("Upgrading to BASE 3"); 1067 sc.login(loginRequest); 1062 1068 if (sc.getLoggedInUserId() != SystemItems.getId(User.ROOT)) 1063 1069 { -
trunk/src/core/net/sf/basedb/core/authentication/AuthenticationInformation.java
r6423 r6424 25 25 /** 26 26 Objects of this class are returned by the 27 {@link Authenticat or#authenticate(String,String)}27 {@link AuthenticationManager#authenticate()} 28 28 method and contains information about the authenticated 29 29 user. The only required fields are {@link #id} and {@link #login}. … … 32 32 <p> 33 33 If the implementation supports extra information, ie. the call to 34 {@link Authenticat or#supportsExtraInformation()}34 {@link AuthenticationManager#supportsExtraInformation()} 35 35 returns TRUE, the other fields may also contain information. 36 36 -
trunk/src/install/net/sf/basedb/install/Webclient.java
r6070 r6424 35 35 import net.sf.basedb.core.BaseException; 36 36 import net.sf.basedb.core.ItemNotFoundException; 37 import net.sf.basedb.core.authentication.LoginRequest; 37 38 import net.sf.basedb.plugins.HelpImporter; 38 39 import net.sf.basedb.util.extensions.xml.PluginInfo; … … 93 94 Application.start(false); 94 95 SessionControl sc = Application.newSessionControl(null, null, null); 95 sc.login(login, password, "Installing web client"); 96 LoginRequest loginRequest = new LoginRequest(login, password); 97 loginRequest.setComment("Installing web client"); 98 sc.login(loginRequest); 96 99 97 100 DbControl dc = sc.newDbControl(); -
trunk/src/test/TestClient.java
r5827 r6424 22 22 */ 23 23 import net.sf.basedb.core.*; 24 import net.sf.basedb.core.authentication.LoginRequest; 24 25 25 26 import java.util.Date; … … 204 205 Client c = Client.getById(dc, id); 205 206 SessionControl sc = Application.newSessionControl(c.getExternalId(), null, null); 206 sc.login(TestUtil.getLogin(), TestUtil.getPassword(), "Running test program"); 207 LoginRequest loginRequest = new LoginRequest(TestUtil.getLogin(), TestUtil.getPassword()); 208 loginRequest.setComment("Running test program"); 209 sc.login(loginRequest); 207 210 sc.logout(); 208 211 write("--Login/logout OK"); -
trunk/src/test/TestUtil.java
r5827 r6424 28 28 import net.sf.basedb.core.Permission; 29 29 import net.sf.basedb.core.Version; 30 import net.sf.basedb.core.authentication.LoginRequest; 30 31 31 32 import java.io.File; … … 188 189 throws BaseException 189 190 { 190 sc.login(login, password, "Running test program"); 191 LoginRequest loginRequest = new LoginRequest(login, password); 192 loginRequest.setComment("Running test program"); 193 sc.login(loginRequest); 191 194 } 192 195 -
trunk/src/test/net/sf/basedb/test/TestUtil.java
r5827 r6424 37 37 import net.sf.basedb.core.DbControl; 38 38 import net.sf.basedb.core.SessionControl; 39 import net.sf.basedb.core.authentication.LoginRequest; 39 40 40 41 /** … … 165 166 { 166 167 write("--Logging in as: " + login + "\n"); 167 getSessionControl().login(login, password, "Running test program"); 168 LoginRequest loginRequest = new LoginRequest(login, password); 169 loginRequest.setComment("Running test program"); 170 getSessionControl().login(loginRequest); 168 171 } 169 172 -
trunk/src/webservices/server/net/sf/basedb/ws/server/SessionService.java
r5827 r6424 24 24 import net.sf.basedb.core.Application; 25 25 import net.sf.basedb.core.SessionControl; 26 import net.sf.basedb.core.authentication.LoginRequest; 26 27 import net.sf.basedb.info.VersionInfo; 27 28 … … 65 66 { 66 67 SessionControl sc = getSessionControl(ID); 67 sc.login(login, password, comment); 68 LoginRequest loginRequest = new LoginRequest(login, password); 69 loginRequest.setComment(comment); 70 sc.login(loginRequest); 68 71 return ID; 69 72 } -
trunk/www/login.jsp
r5827 r6424 36 36 <%@ page pageEncoding="UTF-8" session="false" 37 37 import="net.sf.basedb.core.*" 38 import="net.sf.basedb.core.authentication.LoginRequest" 38 39 import="net.sf.basedb.clients.web.Base" 39 40 import="net.sf.basedb.clients.web.WebException" … … 59 60 { 60 61 if (sc.isLoggedIn()) sc.logout(); 61 sc.login(login, password, null); 62 LoginRequest loginRequest = new LoginRequest(login, password); 63 sc.login(loginRequest); 62 64 } 63 65 catch (LoginException ex) … … 69 71 { 70 72 errorTitle = "Login not found"; 71 errorMessage = Values.formatMessage( 72 "The user with login {1} is not a registered user for BASE.", 73 HTML.encodeTags(login) 74 ); 73 errorMessage = ex.getMessage(); 75 74 } 76 75 catch (InvalidPasswordException ex) 77 76 { 78 77 errorTitle = "Invalid password"; 79 errorMessage = Values.formatMessage( 80 "The password for login {1} is not correct.", 81 HTML.encodeTags(login) 82 ); 78 errorMessage = ex.getMessage(); 83 79 } 84 80 catch (PermissionDeniedException ex) 85 81 { 86 82 errorTitle = "Permission denied"; 87 errorMessage = Values.formatMessage( 88 "You do not have permission to log in to BASE.<br>"+ex.getMessage(), 89 HTML.encodeTags(login) 90 ); 83 errorMessage = ex.getMessage(); 91 84 } 92 85
Note: See TracChangeset
for help on using the changeset viewer.