Removed checked exception from LoginCredential constructor
This commit is contained in:
parent
cb727ca084
commit
7342841b33
@ -21,7 +21,6 @@
|
|||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="module" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
@ -1,22 +1,27 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="envoy-common">
|
|
||||||
|
<wb-module deploy-name="envoy-common">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
|
|
||||||
|
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
|
||||||
|
|
||||||
</wb-module>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</wb-module>
|
||||||
</project-modules>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</project-modules>
|
||||||
|
@ -27,11 +27,12 @@ public final class GroupMessage extends Message {
|
|||||||
*
|
*
|
||||||
* @param id unique ID
|
* @param id unique ID
|
||||||
* @param senderID the ID of the user who sends the message
|
* @param senderID the ID of the user who sends the message
|
||||||
* @param recipientID the ID of the user who receives the message
|
* @param groupID the ID of the group which receives the message
|
||||||
* @param creationDate the creation date of the message
|
* @param creationDate the creation date of the message
|
||||||
* @param text the text content of the message
|
* @param text the text content of the message
|
||||||
* @param attachment the attachment of the message, if present
|
* @param attachment the attachment of the message, if present
|
||||||
* @param status the current {@link MessageStatus} of the message
|
* @param status the current {@link Message.MessageStatus} of the
|
||||||
|
* message
|
||||||
* @param forwarded whether this message was forwarded
|
* @param forwarded whether this message was forwarded
|
||||||
* @param memberStatuses a map of all members and their status according to this
|
* @param memberStatuses a map of all members and their status according to this
|
||||||
* {@link GroupMessage}
|
* {@link GroupMessage}
|
||||||
|
@ -30,16 +30,22 @@ public class LoginCredentials implements Serializable {
|
|||||||
* @param password the password of the user (will be converted to a hash)
|
* @param password the password of the user (will be converted to a hash)
|
||||||
* @param registration signifies that these credentials are used for user
|
* @param registration signifies that these credentials are used for user
|
||||||
* registration instead of user login
|
* registration instead of user login
|
||||||
* @throws NoSuchAlgorithmException if the algorithm used is unknown
|
|
||||||
* @since Envoy Common v0.2-alpha
|
* @since Envoy Common v0.2-alpha
|
||||||
*/
|
*/
|
||||||
public LoginCredentials(String identifier, char[] password, boolean registration) throws NoSuchAlgorithmException {
|
public LoginCredentials(String identifier, char[] password, boolean registration) {
|
||||||
this.identifier = identifier;
|
this.identifier = identifier;
|
||||||
passwordHash = getSha256(toByteArray(password));
|
passwordHash = getSha256(toByteArray(password));
|
||||||
this.registration = registration;
|
this.registration = registration;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] getSha256(byte[] input) throws NoSuchAlgorithmException { return MessageDigest.getInstance("SHA-256").digest(input); }
|
private byte[] getSha256(byte[] input) {
|
||||||
|
try {
|
||||||
|
return MessageDigest.getInstance("SHA-256").digest(input);
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
// This will never happen
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private byte[] toByteArray(char[] chars) {
|
private byte[] toByteArray(char[] chars) {
|
||||||
byte[] bytes = new byte[chars.length * 2];
|
byte[] bytes = new byte[chars.length * 2];
|
||||||
|
Reference in New Issue
Block a user