diff --git a/pom.xml b/pom.xml
index e2fb3ec..d673614 100644
--- a/pom.xml
+++ b/pom.xml
@@ -90,7 +90,6 @@
${maven.compiler.source}
${maven.compiler.target}
- ${project.build.sourceEncoding}
@@ -102,6 +101,110 @@
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ attach-sources
+
+ jar
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.0.0-M5
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 3.2.0
+
+ private
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 3.1.0
+
+ CheckStyle.xml
+ true
+ true
+ true
+ true
+
+
+
+ net.revelc.code.formatter
+ formatter-maven-plugin
+ 2.12.2
+
+ UTF-8
+ LF
+ Formatter.xml
+
+ src/
+ test/src
+
+
+ **/*.java
+
+
+ module-info.java
+
+
+
+
+
+ validate
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 3.2.0
+
+ public
+
+
+
+
\ No newline at end of file
diff --git a/src/io/scenarium/oauth/UserResource.java b/src/io/scenarium/oauth/UserResource.java
index 70cf5a2..953b9fa 100755
--- a/src/io/scenarium/oauth/UserResource.java
+++ b/src/io/scenarium/oauth/UserResource.java
@@ -302,7 +302,7 @@ public class UserResource {
// create token:
String tok = randomString(128);
long idToken = -1;
- query = "INSERT INTO `token` (`userId`, `token`, `createTime`, `endValidityTime`) VALUES (?, ?, now(), ADDTIME(now(),'23:45:0'));";
+ query = "INSERT INTO `token` (`userId`, `token`, `createTime`, `endValidityTime`) VALUES (?, ?, now(), ADDTIME(now(),'20:12:18'));";
try {
PreparedStatement ps = entry.connection.prepareStatement(query, Statement.RETURN_GENERATED_KEYS);
ps.setLong(1, user.id);
@@ -360,19 +360,19 @@ public class UserResource {
*/
-
-
-
+ public static String bytesToHex(byte[] bytes) {
+ StringBuilder sb = new StringBuilder();
+ for (byte b : bytes) {
+ sb.append(String.format("%02x", b));
+ }
+ return sb.toString();
+ }
public String getSHA512(String passwordToHash){
try {
MessageDigest md = MessageDigest.getInstance("SHA-512");
byte[] bytes = md.digest(passwordToHash.getBytes(StandardCharsets.UTF_8));
- StringBuilder sb = new StringBuilder();
- for(int i=0; i< bytes.length ;i++){
- sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
- }
- return sb.toString();
+ return bytesToHex(bytes);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}