Changeset 1504 for trunk/src/org/expeditee/auth/account/Authenticate.java
- Timestamp:
- 01/29/20 13:20:24 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/auth/account/Authenticate.java
r1478 r1504 1 1 package org.expeditee.auth.account; 2 2 3 import java.io.IOException;4 import java.security.InvalidKeyException;5 import java.security.KeyFactory;6 import java.security.KeyStoreException;7 import java.security.NoSuchAlgorithmException;8 import java.security.PrivateKey;9 import java.security.cert.CertificateException;10 import java.security.spec.InvalidKeySpecException;11 import java.security.spec.PKCS8EncodedKeySpec;12 import java.sql.SQLException;13 import java.text.ParseException;14 3 import java.util.ArrayList; 15 4 import java.util.Base64; … … 18 7 import java.util.Map; 19 8 20 import javax.crypto.BadPaddingException;21 import javax.crypto.IllegalBlockSizeException;22 import javax.crypto.NoSuchPaddingException;23 9 import javax.crypto.SecretKey; 24 10 … … 96 82 MessageBay.clear(); 97 83 MessageBay.updateFramesetLocation(); 98 MailBay. disconnect();84 MailBay.reconnectToUser(UserSettings.UserName.get()); 99 85 100 86 // Parse the users profile to refresh settings. … … 108 94 AuthenticationResult res = AuthenticationResult.SuccessLogin; 109 95 110 // Check mail and update last read files. 111 MailBay.clear(); 112 try { 113 Text keyItem = KeyList.PrivateKey.get(); 114 if (keyItem.getData() != null) { 115 // Check mail. 116 String keyEncoded = keyItem.getData().get(0); 117 byte[] keyBytes = Base64.getDecoder().decode(keyEncoded); 118 PrivateKey key = KeyFactory.getInstance(AsymmetricAlgorithm).generatePrivate(new PKCS8EncodedKeySpec(keyBytes)); 119 org.expeditee.auth.mail.Mail.checkMail(key); 120 } else { 121 res.additionalInfo.add("No private key present: your communication with other Expeditee users will be limited until this is resolved."); 122 } 123 } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | ClassNotFoundException 124 | SQLException | ParseException | IOException | InvalidKeyException | NoSuchPaddingException | 125 IllegalBlockSizeException | BadPaddingException e) { 126 res.additionalInfo.add("An error occured while attempting to load in mail sent to you by other Expeditee users. See the exception for more information."); 127 e.printStackTrace(); 128 } catch (InvalidKeySpecException e) { 129 res.additionalInfo.add("Stored data cannot be used to create a private key. See exception for more information."); 130 e.printStackTrace(); 131 } 96 // Check mail for new user. 97 MailBay.checkMail(); 132 98 133 99 Collection<Item> usernameFields = Actions.getByData(FrameIO.LoadFrame("multiuser1"), "txtUsername"); … … 155 121 UserSettings.setupDefaultFolders(); 156 122 MessageBay.updateFramesetLocation(); 157 MailBay.disconnect();158 123 159 124 // Reset all of the settings.
Note:
See TracChangeset
for help on using the changeset viewer.