- Timestamp:
- 04/11/19 15:42:27 (5 years ago)
- Location:
- trunk/src/org
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/apollo/io/AudioPathManager.java
r1244 r1303 12 12 import org.apollo.util.ApolloSystemLog; 13 13 import org.apollo.util.RegExpFileFilter; 14 import org.expeditee. gui.Browser;14 import org.expeditee.auth.AuthenticatorBrowser; 15 15 import org.expeditee.gui.FrameIO; 16 16 import org.expeditee.settings.UserSettings; … … 45 45 public static void changeParentAndSubFolders(String newFolder) { 46 46 47 if (Boolean.getBoolean("auth") && System.getProperty("user.name").equals( Browser.USER_NOBODY)) {48 System.err.println("**** AudioPathManager::changeParentAndSubFolder(): Nothing to do for user '" + Browser.USER_NOBODY + "'");47 if (Boolean.getBoolean("auth") && System.getProperty("user.name").equals(AuthenticatorBrowser.USER_NOBODY)) { 48 System.err.println("**** AudioPathManager::changeParentAndSubFolder(): Nothing to do for user '" + AuthenticatorBrowser.USER_NOBODY + "'"); 49 49 return; 50 50 } -
trunk/src/org/expeditee/auth/Actions.java
r1299 r1303 43 43 import org.expeditee.agents.InvalidFramesetNameException; 44 44 import org.expeditee.auth.Mail.MailEntry; 45 import org.expeditee.auth.account.Authenticate; 46 import org.expeditee.auth.account.Authenticate.AuthenticationResult; 45 47 import org.expeditee.auth.gui.MailBay; 46 48 import org.expeditee.auth.tags.AuthenticationTag; … … 185 187 * @throws Exception 186 188 */ 187 public static void AuthLogin() throws Exception{189 public static void AuthLogin() { 188 190 final Collection<Text> textItems = DisplayController.getCurrentFrame().getTextItems(); 189 191 final Optional<Map<AuthenticationTag, String>> userdata = AuthenticationTag.fetchUserData(textItems, false, AuthenticationTag.Username, AuthenticationTag.Password); 190 if (userdata.isPresent()) { 191 login(userdata.get()); 192 if (userdata.isPresent()) { 193 AuthenticationResult result = Authenticate.login(userdata.get()); 194 if (result == AuthenticationResult.SuccessLogin) { 195 MessageBay.displayMessage(result.toString()); 196 } else { 197 MessageBay.errorMessage(result.toString()); 198 } 199 //login(userdata.get()); 192 200 AuthenticatorBrowser.Authenticated = true; 193 201 } else { 194 202 MessageBay.errorMessage(Constants.ERROR_INSUFFICIENT_INFORMATION_PROVIDED); 195 203 } 204 } 205 206 public static void AuthLogout() { 207 MessageBay.displayMessage(Authenticate.logout().toString()); 196 208 } 197 209 … … 493 505 String password = userdata.get(AuthenticationTag.Password); 494 506 495 if (username.equals( Browser.USER_NOBODY)) {507 if (username.equals(AuthenticatorBrowser.USER_NOBODY)) { 496 508 return; 497 509 } -
trunk/src/org/expeditee/auth/AuthenticatorBrowser.java
r1287 r1303 78 78 79 79 private KeyStore keyStore = KeyStore.getInstance(KeystoreType); 80 public static String USER_NOBODY = "nobody"; 80 81 81 82 private static final byte[] TRUE = "yes".getBytes(); … … 95 96 96 97 public static boolean isAuthenticated() { 97 return isAuthenticationRequired() && !UserSettings.UserName.get().equals( Browser.USER_NOBODY);98 return isAuthenticationRequired() && !UserSettings.UserName.get().equals(AuthenticatorBrowser.USER_NOBODY); 98 99 } 99 100 … … 225 226 } 226 227 227 final void loadMailDatabase() throws SQLException, FileNotFoundException, ParseException {228 public final void loadMailDatabase() throws SQLException, FileNotFoundException, ParseException { 228 229 Path deadDropPath = Paths.get(FrameIO.DEAD_DROPS_PATH); 229 230 for (File connectionDir: deadDropPath.toFile().listFiles()) { … … 239 240 } 240 241 241 final void updateLastReadMailTime(Path deaddropforcontactPath) {242 public final void updateLastReadMailTime(Path deaddropforcontactPath) { 242 243 Path timestamp = deaddropforcontactPath.resolve(UserSettings.UserName.get() + ".last-accessed"); 243 244 try(FileWriter out = new FileWriter(timestamp.toFile())) { … … 304 305 } 305 306 306 final SecretKey getSecretKey(final String label, final String password) throws NoSuchAlgorithmException, KeyStoreException {307 public final SecretKey getSecretKey(final String label, final String password) throws NoSuchAlgorithmException, KeyStoreException { 307 308 308 309 char[] password_ca = password.toCharArray(); … … 318 319 } 319 320 320 final void putKey(final String label, final String password, final SecretKey key) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException {321 public final void putKey(final String label, final String password, final SecretKey key) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException { 321 322 final KeyStore.SecretKeyEntry entry = new KeyStore.SecretKeyEntry(key); 322 323 final KeyStore.ProtectionParameter entryPassword = new KeyStore.PasswordProtection(password.toCharArray()); … … 325 326 } 326 327 327 final boolean confirmIntergalaticNumber(final String username, final String email, final String intergalacticNumber) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, FileNotFoundException, IOException {328 public final boolean confirmIntergalaticNumber(final String username, final String email, final String intergalacticNumber) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, FileNotFoundException, IOException { 328 329 try { 329 330 final KeyStore.ProtectionParameter entryPassword = new KeyStore.PasswordProtection(intergalacticNumber.toCharArray()); … … 341 342 } 342 343 343 final String newIntergalacticNumber(final String username, final String email) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException {344 public final String newIntergalacticNumber(final String username, final String email) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException { 344 345 // generate intergalactic number 345 346 final SecureRandom rand = new SecureRandom(); … … 357 358 } 358 359 359 final PublicKey getPublicKey(String username) throws InvalidKeySpecException, NoSuchAlgorithmException, FileNotFoundException {360 public final PublicKey getPublicKey(String username) throws InvalidKeySpecException, NoSuchAlgorithmException, FileNotFoundException { 360 361 // load in frame with public key on it. 361 362 String credentialsFramesetPath = FrameIO.CONTACTS_PATH + username + "-credentials" + File.separator; … … 386 387 } 387 388 388 final void markRequestedColleagues(String username) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException {389 public final void markRequestedColleagues(String username) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException { 389 390 KeyStore.SecretKeyEntry entry = new KeyStore.SecretKeyEntry(new SecretKeySpec(TRUE, SymmetricAlgorithm)); 390 391 KeyStore.ProtectionParameter entryPassword = new KeyStore.PasswordProtection(KeyList.PersonalKey.get().getText().toCharArray()); … … 393 394 } 394 395 395 final void clearRequestedColleagues(String username) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException {396 public final void clearRequestedColleagues(String username) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, FileNotFoundException, IOException { 396 397 KeyStore.SecretKeyEntry entry = new KeyStore.SecretKeyEntry(new SecretKeySpec(FALSE, SymmetricAlgorithm)); 397 398 KeyStore.ProtectionParameter entryPassword = new KeyStore.PasswordProtection(KeyList.PersonalKey.get().getText().toCharArray()); … … 400 401 } 401 402 402 final boolean hasRequestedColleagues(String username) throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableEntryException {403 public final boolean hasRequestedColleagues(String username) throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableEntryException { 403 404 String alias = username + "colleaguesRequested"; 404 405 if (!keyStore.containsAlias(alias)) { -
trunk/src/org/expeditee/auth/gui/MailBay.java
r1295 r1303 51 51 52 52 /** The currently logged in user, consulted when deciding if a new FrameCreator is needed. */ 53 private static String currentUser = UserSettings.UserName.get();53 private static String _forUser = UserSettings.UserName.get(); 54 54 55 55 /** The link that the preview pane displays pointing towards unprocessed messages. */ … … 78 78 public static boolean isPreviewMailItem(Item i) { 79 79 return _previewMessages.contains(i) || i == _mailLink; 80 } 81 82 public static void disconnect() { 83 if (_forUser != UserSettings.UserName.get()) { 84 _creator = null; 85 _forUser = UserSettings.UserName.get(); 86 } 80 87 } 81 88 … … 91 98 92 99 // Ensure frame creator 93 if (_creator == null || currentUser != UserSettings.UserName.get()) {94 currentUser = UserSettings.UserName.get();100 if (_creator == null || _forUser != UserSettings.UserName.get()) { 101 _forUser = UserSettings.UserName.get(); 95 102 _creator = new FrameCreator(EXPEDITEE_MAIL_FRAMESET_NAME, FrameIO.MAIL_PATH, EXPEDITEE_MAIL_FRAMESET_NAME, FrameCreator.ExistingFramesetOptions.AppendAfterLastItem, false); 96 103 } -
trunk/src/org/expeditee/gui/Browser.java
r1293 r1303 149 149 public static boolean _hasExited = false; 150 150 151 public static String USER_NOBODY = "nobody";152 153 151 /** A flag which is set once the application is exiting. */ 154 152 protected boolean _isExiting = false; … … 168 166 String starting_user_name = System.getProperty("user.name"); 169 167 System.setProperty("startinguser.name", starting_user_name); 170 System.setProperty("user.name", USER_NOBODY);168 System.setProperty("user.name", AuthenticatorBrowser.USER_NOBODY); 171 169 } 172 170 -
trunk/src/org/expeditee/gui/FrameIO.java
r1293 r1303 168 168 if (!UserSettings.PublicAndPrivateResources || !AuthenticatorBrowser.isAuthenticated()) { 169 169 170 if (UserSettings.UserName.get().equals( Browser.USER_NOBODY)) {171 System.err.println("**** FrameIO::changeParentAndSubFolders(): Not setting subfolders for user '"+ Browser.USER_NOBODY+"'");170 if (UserSettings.UserName.get().equals(AuthenticatorBrowser.USER_NOBODY)) { 171 System.err.println("**** FrameIO::changeParentAndSubFolders(): Not setting subfolders for user '"+AuthenticatorBrowser.USER_NOBODY+"'"); 172 172 } 173 173 -
trunk/src/org/expeditee/gui/MessageBay.java
r1300 r1303 224 224 return displayMessage(message, link, actions, color, displayAlways); 225 225 } 226 227 public static void updateFramesetLocation() { 228 if (_forUser != UserSettings.UserName.get()) { 229 _creator = new FrameCreator(MESSAGES_FRAMESET_NAME, FrameIO.MESSAGES_PATH, MESSAGES_FRAMESET_NAME, FrameCreator.ExistingFramesetOptions.OverrideExistingFrames, 230 false); 231 _forUser = UserSettings.UserName.get(); 232 } 233 } 226 234 227 235 /** TODO: Comment. cts16 */ … … 240 248 return t; 241 249 } 242 250 243 251 /** TODO: Comment. cts16 */ 244 252 private synchronized static Text displayMessage(String message, String link, List<String> actions, Colour color, … … 268 276 _lastMessage = message; 269 277 270 if (_creator == null || _forUser == null || !_forUser.equals(UserSettings.UserName.get())) {278 if (_creator == null) { 271 279 _creator = new FrameCreator(MESSAGES_FRAMESET_NAME, FrameIO.MESSAGES_PATH, MESSAGES_FRAMESET_NAME, FrameCreator.ExistingFramesetOptions.OverrideExistingFrames, 272 280 false); … … 562 570 return _status; 563 571 } 564 565 572 } -
trunk/src/org/expeditee/settings/Settings.java
r1280 r1303 118 118 e.printStackTrace(); 119 119 } 120 } 121 } 122 123 public static void resetAllSettings() { 124 for (PageDescriptor pd : _pages.values()) { 125 for (VariableSetting s : pd.settingsList) { 126 s.reset(); 127 } 120 128 } 121 129 }
Note:
See TracChangeset
for help on using the changeset viewer.