spring boot init
spring boot init
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
package org.maxkey.authz.oauth2.common.util;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class SerializationUtils {
|
||||
|
||||
public static byte[] serialize(Object state) {
|
||||
ObjectOutputStream oos = null;
|
||||
try {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(512);
|
||||
oos = new ObjectOutputStream(bos);
|
||||
oos.writeObject(state);
|
||||
oos.flush();
|
||||
return bos.toByteArray();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
finally {
|
||||
if (oos != null) {
|
||||
try {
|
||||
oos.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
// eat it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T deserialize(byte[] byteArray) {
|
||||
ObjectInputStream oip = null;
|
||||
try {
|
||||
oip = new ObjectInputStream(new ByteArrayInputStream(byteArray));
|
||||
@SuppressWarnings("unchecked")
|
||||
T result = (T) oip.readObject();
|
||||
return result;
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
finally {
|
||||
if (oip != null) {
|
||||
try {
|
||||
oip.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
// eat it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,8 +6,8 @@ import java.sql.Types;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.maxkey.authz.oauth2.common.util.SerializationUtils;
|
||||
import org.maxkey.authz.oauth2.provider.OAuth2Authentication;
|
||||
import org.maxkey.util.SerializationUtils;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
|
||||
@@ -17,11 +17,11 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.maxkey.authz.oauth2.common.OAuth2AccessToken;
|
||||
import org.maxkey.authz.oauth2.common.OAuth2RefreshToken;
|
||||
import org.maxkey.authz.oauth2.common.util.SerializationUtils;
|
||||
import org.maxkey.authz.oauth2.provider.OAuth2Authentication;
|
||||
import org.maxkey.authz.oauth2.provider.token.AuthenticationKeyGenerator;
|
||||
import org.maxkey.authz.oauth2.provider.token.DefaultAuthenticationKeyGenerator;
|
||||
import org.maxkey.authz.oauth2.provider.token.TokenStore;
|
||||
import org.maxkey.util.SerializationUtils;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
|
||||
Reference in New Issue
Block a user