spring boot init

spring boot init
This commit is contained in:
shimingxy
2019-09-04 23:47:22 +08:00
parent 6181f5d657
commit fb15e2b070
1192 changed files with 2693 additions and 4070 deletions

View File

@@ -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
}
}
}
}
}

View File

@@ -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;

View File

@@ -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;