mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-07 17:38:32 +08:00
Resource fix
Resource fix LOG4J2 PatternLayout debug change
This commit is contained in:
parent
c80205883f
commit
166b8362d3
@ -1,3 +1,4 @@
|
|||||||
|
package org.maxkey.crypto.jose.keystore;
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright 2014 The MITRE Corporation
|
* Copyright 2014 The MITRE Corporation
|
||||||
* and the MIT Kerberos and Internet Trust Consortium
|
* and the MIT Kerberos and Internet Trust Consortium
|
||||||
@ -14,110 +15,111 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.maxkey.crypto.jose.keystore;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.springframework.core.io.Resource;
|
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.io.CharStreams;
|
import com.google.common.io.CharStreams;
|
||||||
import com.nimbusds.jose.jwk.JWK;
|
import com.nimbusds.jose.jwk.JWK;
|
||||||
import com.nimbusds.jose.jwk.JWKSet;
|
import com.nimbusds.jose.jwk.JWKSet;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.List;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* .
|
||||||
* @author jricher
|
* @author jricher
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class JWKSetKeyStore {
|
public class JWKSetKeyStore {
|
||||||
|
private static final Logger _logger = LoggerFactory.getLogger(JWKSetKeyStore.class);
|
||||||
|
private JWKSet jwkSet;
|
||||||
|
|
||||||
private JWKSet jwkSet;
|
private Resource location;
|
||||||
|
|
||||||
private Resource location;
|
public JWKSetKeyStore() {
|
||||||
|
|
||||||
public JWKSetKeyStore() {
|
}
|
||||||
|
|
||||||
}
|
public JWKSetKeyStore(JWKSet jwkSet) {
|
||||||
|
this.jwkSet = jwkSet;
|
||||||
|
initializeJwkSet();
|
||||||
|
}
|
||||||
|
|
||||||
public JWKSetKeyStore(JWKSet jwkSet) {
|
private void initializeJwkSet() {
|
||||||
this.jwkSet = jwkSet;
|
|
||||||
initializeJwkSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initializeJwkSet() {
|
if (jwkSet == null) {
|
||||||
|
if (location != null) {
|
||||||
|
|
||||||
if (jwkSet == null) {
|
if (location.exists() && location.isReadable()) {
|
||||||
if (location != null) {
|
|
||||||
|
|
||||||
if (location.exists() && location.isReadable()) {
|
try {
|
||||||
|
_logger.debug("JWK location " + location.getURL());
|
||||||
|
// read in the file from disk
|
||||||
|
String s = CharStreams
|
||||||
|
.toString(new InputStreamReader(location.getInputStream(), Charsets.UTF_8));
|
||||||
|
|
||||||
try {
|
// parse it into a jwkSet object
|
||||||
// read in the file from disk
|
jwkSet = JWKSet.parse(s);
|
||||||
String s = CharStreams.toString(new InputStreamReader(location.getInputStream(), Charsets.UTF_8));
|
} catch (IOException e) {
|
||||||
|
throw new IllegalArgumentException("Key Set resource could not be read: " + location);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new IllegalArgumentException("Key Set resource could not be parsed: " + location);
|
||||||
|
}
|
||||||
|
|
||||||
// parse it into a jwkSet object
|
} else {
|
||||||
jwkSet = JWKSet.parse(s);
|
throw new IllegalArgumentException("Key Set resource could not be read: " + location);
|
||||||
} catch (IOException e) {
|
}
|
||||||
throw new IllegalArgumentException("Key Set resource could not be read: " + location);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new IllegalArgumentException("Key Set resource could not be parsed: " + location); }
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Key Set resource could not be read: " + location);
|
throw new IllegalArgumentException(
|
||||||
}
|
"Key store must be initialized with at least one of a jwkSet or a location.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
/**
|
||||||
throw new IllegalArgumentException("Key store must be initialized with at least one of a jwkSet or a location.");
|
* @return the jwkSet
|
||||||
}
|
*/
|
||||||
}
|
public JWKSet getJwkSet() {
|
||||||
}
|
return jwkSet;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the jwkSet
|
* @param jwkSet the jwkSet to set
|
||||||
*/
|
*/
|
||||||
public JWKSet getJwkSet() {
|
public void setJwkSet(JWKSet jwkSet) {
|
||||||
return jwkSet;
|
this.jwkSet = jwkSet;
|
||||||
}
|
initializeJwkSet();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param jwkSet the jwkSet to set
|
* @return the location
|
||||||
*/
|
*/
|
||||||
public void setJwkSet(JWKSet jwkSet) {
|
public Resource getLocation() {
|
||||||
this.jwkSet = jwkSet;
|
return location;
|
||||||
initializeJwkSet();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the location
|
|
||||||
*/
|
|
||||||
public Resource getLocation() {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param location the location to set
|
|
||||||
*/
|
|
||||||
public void setLocation(Resource location) {
|
|
||||||
this.location = location;
|
|
||||||
initializeJwkSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the list of keys in this keystore. This is a passthrough to the underlying JWK Set
|
|
||||||
*/
|
|
||||||
public List<JWK> getKeys() {
|
|
||||||
if (jwkSet == null) {
|
|
||||||
initializeJwkSet();
|
|
||||||
}
|
|
||||||
return jwkSet.getKeys();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param location the location to set
|
||||||
|
*/
|
||||||
|
public void setLocation(Resource location) {
|
||||||
|
this.location = location;
|
||||||
|
|
||||||
|
initializeJwkSet();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of keys in this keystore. This is a passthrough to the
|
||||||
|
* underlying JWK Set
|
||||||
|
*/
|
||||||
|
public List<JWK> getKeys() {
|
||||||
|
if (jwkSet == null) {
|
||||||
|
initializeJwkSet();
|
||||||
|
}
|
||||||
|
return jwkSet.getKeys();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,105 +1,105 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.maxkey.crypto.keystore;
|
package org.maxkey.crypto.keystore;
|
||||||
|
|
||||||
import java.security.KeyStore;
|
import java.security.KeyStore;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.util.ResourceUtils;
|
import org.springframework.util.ResourceUtils;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* .
|
||||||
* @author Crystal.Sea
|
* @author Crystal.Sea
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class KeyStoreLoader implements InitializingBean{
|
public class KeyStoreLoader implements InitializingBean {
|
||||||
private final static Logger _logger = LoggerFactory.getLogger(KeyStoreLoader.class);
|
private static final Logger _logger = LoggerFactory.getLogger(KeyStoreLoader.class);
|
||||||
|
|
||||||
private KeyStore keyStore;
|
private KeyStore keyStore;
|
||||||
|
|
||||||
private String entityName;
|
|
||||||
private String keystoreFile;
|
|
||||||
private String keystorePassword;
|
|
||||||
|
|
||||||
private String keystoreType = "JKS";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public KeyStoreLoader() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
private String entityName;
|
||||||
* @return the keyStore
|
private Resource keystoreFile;
|
||||||
*/
|
private String keystorePassword;
|
||||||
public KeyStore getKeyStore() {
|
|
||||||
return keyStore;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
private String keystoreType = "JKS";
|
||||||
* @param keystoreFile the keystoreFile to set
|
|
||||||
*/
|
|
||||||
public void setKeystoreFile(String keystoreFile) {
|
|
||||||
this.keystoreFile = keystoreFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public KeyStoreLoader() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the keyStore
|
||||||
|
*/
|
||||||
|
public KeyStore getKeyStore() {
|
||||||
|
return keyStore;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param keystorePassword the keystorePassword to set
|
* @param keystoreFile the keystoreFile to set
|
||||||
*/
|
*/
|
||||||
public void setKeystorePassword(String keystorePassword) {
|
public void setKeystoreFile(Resource keystoreFile) {
|
||||||
this.keystorePassword = keystorePassword;
|
this.keystoreFile = keystoreFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <EFBFBD><EFBFBD>ȡKeyStore<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* @param keystorePassword the keystorePassword to set
|
||||||
* @return
|
*/
|
||||||
*/
|
public void setKeystorePassword(String keystorePassword) {
|
||||||
public String getKeystorePassword() {
|
this.keystorePassword = keystorePassword;
|
||||||
return keystorePassword;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public void afterPropertiesSet() throws Exception {
|
* <EFBFBD><EFBFBD>ȡKeyStore<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
_logger.debug("Load KeyStore from file "+ResourceUtils.getFile(keystoreFile).getPath());
|
*
|
||||||
keyStore =KeyStoreUtil.loadKeyStore(ResourceUtils.getFile(keystoreFile), keystorePassword.toCharArray(), KeyStoreType.JKS);
|
* @return
|
||||||
_logger.debug("Load KeyStore success . ");
|
*/
|
||||||
|
public String getKeystorePassword() {
|
||||||
Enumeration<String> temp = keyStore.aliases();
|
return keystorePassword;
|
||||||
int i=0;
|
}
|
||||||
while(temp.hasMoreElements()){
|
|
||||||
_logger.debug("KeyStore alias name "+(i++)+" : "+temp.nextElement());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
_logger.debug("Load KeyStore from file " + keystoreFile.getURL());
|
||||||
|
keyStore = KeyStoreUtil.loadKeyStore(
|
||||||
|
keystoreFile, keystorePassword.toCharArray(),
|
||||||
|
KeyStoreType.JKS);
|
||||||
|
_logger.debug("Load KeyStore success . ");
|
||||||
|
|
||||||
|
Enumeration<String> temp = keyStore.aliases();
|
||||||
|
int i = 0;
|
||||||
|
while (temp.hasMoreElements()) {
|
||||||
|
_logger.debug("KeyStore alias name " + (i++) + " : " + temp.nextElement());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the entityName
|
* .
|
||||||
*/
|
* @return the entityName
|
||||||
public String getEntityName() {
|
*/
|
||||||
return entityName;
|
public String getEntityName() {
|
||||||
}
|
return entityName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param entityName the entityName to set
|
* @param entityName the entityName to set
|
||||||
*/
|
*/
|
||||||
public void setEntityName(String entityName) {
|
public void setEntityName(String entityName) {
|
||||||
this.entityName = entityName;
|
this.entityName = entityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the keystoreType
|
|
||||||
*/
|
|
||||||
public String getKeystoreType() {
|
|
||||||
return keystoreType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the keystoreType
|
||||||
|
*/
|
||||||
|
public String getKeystoreType() {
|
||||||
|
return keystoreType;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,7 @@ public class ConfigurerFreeMarker implements ApplicationContextAware {
|
|||||||
Map<String, Object> map = this.applicationContext.getBeansWithAnnotation(FreemarkerTag.class);
|
Map<String, Object> map = this.applicationContext.getBeansWithAnnotation(FreemarkerTag.class);
|
||||||
for (String key : map.keySet()) {
|
for (String key : map.keySet()) {
|
||||||
configuration.setSharedVariable(key, map.get(key));
|
configuration.setSharedVariable(key, map.get(key));
|
||||||
_logger.debug("FreeMarker Template "+key);
|
_logger.trace("FreeMarker Template "+key);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,7 +60,8 @@ public class InitApplicationContext extends HttpServlet {
|
|||||||
* InitApplicationContext.
|
* InitApplicationContext.
|
||||||
*/
|
*/
|
||||||
public InitApplicationContext() {
|
public InitApplicationContext() {
|
||||||
this.applicationContext = WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
|
this.applicationContext =
|
||||||
|
WebApplicationContextUtils.getWebApplicationContext(this.getServletContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
public InitApplicationContext(ConfigurableApplicationContext applicationContext) {
|
public InitApplicationContext(ConfigurableApplicationContext applicationContext) {
|
||||||
@ -71,20 +72,19 @@ public class InitApplicationContext extends HttpServlet {
|
|||||||
* loadCaches.
|
* loadCaches.
|
||||||
*/
|
*/
|
||||||
public void loadCaches() {
|
public void loadCaches() {
|
||||||
_logger.info(
|
_logger.info("-----------------------------------------------------------");
|
||||||
"----------------------------------------------------------------------------------------------------");
|
|
||||||
_logger.info("Load Caches ");
|
_logger.info("Load Caches ");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (applicationContext.containsBean("cacheFactory")) {
|
if (applicationContext.containsBean("cacheFactory")) {
|
||||||
CacheFactory cacheFactory = applicationContext.getBean("cacheFactory", CacheFactory.class);
|
CacheFactory cacheFactory =
|
||||||
|
applicationContext.getBean("cacheFactory", CacheFactory.class);
|
||||||
cacheFactory.start();
|
cacheFactory.start();
|
||||||
}
|
}
|
||||||
} catch (BeansException e) {
|
} catch (BeansException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
_logger.info(
|
_logger.info("-----------------------------------------------------------");
|
||||||
"----------------------------------------------------------------------------------------------------");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,30 +94,42 @@ public class InitApplicationContext extends HttpServlet {
|
|||||||
public void listDataBaseVariables() {
|
public void listDataBaseVariables() {
|
||||||
if (applicationContext.containsBean("dataSource")) {
|
if (applicationContext.containsBean("dataSource")) {
|
||||||
try {
|
try {
|
||||||
_logger.debug(
|
_logger.debug("-----------------------------------------------------------");
|
||||||
"----------------------------------------------------------------------------------------------------");
|
|
||||||
_logger.debug("List DatabaseMetaData Variables ");
|
_logger.debug("List DatabaseMetaData Variables ");
|
||||||
Connection connection = ((javax.sql.DataSource) applicationContext.getBean("dataSource"))
|
Connection connection =
|
||||||
|
((javax.sql.DataSource) applicationContext.getBean("dataSource"))
|
||||||
.getConnection();
|
.getConnection();
|
||||||
|
|
||||||
java.sql.DatabaseMetaData databaseMetaData = connection.getMetaData();
|
java.sql.DatabaseMetaData databaseMetaData = connection.getMetaData();
|
||||||
_logger.debug("DatabaseProductName : " + databaseMetaData.getDatabaseProductName());
|
_logger.debug("DatabaseProductName : "
|
||||||
_logger.debug("DatabaseProductVersion: " + databaseMetaData.getDatabaseProductVersion());
|
+ databaseMetaData.getDatabaseProductName());
|
||||||
_logger.debug("DatabaseMajorVersion : " + databaseMetaData.getDatabaseMajorVersion());
|
_logger.debug("DatabaseProductVersion: "
|
||||||
_logger.debug("DatabaseMinorVersion : " + databaseMetaData.getDatabaseMinorVersion());
|
+ databaseMetaData.getDatabaseProductVersion());
|
||||||
_logger.debug("supportsTransactions : " + databaseMetaData.supportsTransactions());
|
_logger.debug("DatabaseMajorVersion : "
|
||||||
_logger.debug("DefaultTransaction : " + databaseMetaData.getDefaultTransactionIsolation());
|
+ databaseMetaData.getDatabaseMajorVersion());
|
||||||
_logger.debug("MaxConnections : " + databaseMetaData.getMaxConnections());
|
_logger.debug("DatabaseMinorVersion : "
|
||||||
|
+ databaseMetaData.getDatabaseMinorVersion());
|
||||||
|
_logger.debug("supportsTransactions : "
|
||||||
|
+ databaseMetaData.supportsTransactions());
|
||||||
|
_logger.debug("DefaultTransaction : "
|
||||||
|
+ databaseMetaData.getDefaultTransactionIsolation());
|
||||||
|
_logger.debug("MaxConnections : "
|
||||||
|
+ databaseMetaData.getMaxConnections());
|
||||||
_logger.debug("");
|
_logger.debug("");
|
||||||
_logger.debug("JDBCMajorVersion : " + databaseMetaData.getJDBCMajorVersion());
|
_logger.debug("JDBCMajorVersion : "
|
||||||
_logger.debug("JDBCMinorVersion : " + databaseMetaData.getJDBCMinorVersion());
|
+ databaseMetaData.getJDBCMajorVersion());
|
||||||
_logger.debug("DriverName : " + databaseMetaData.getDriverName());
|
_logger.debug("JDBCMinorVersion : "
|
||||||
_logger.debug("DriverVersion : " + databaseMetaData.getDriverVersion());
|
+ databaseMetaData.getJDBCMinorVersion());
|
||||||
|
_logger.debug("DriverName : "
|
||||||
|
+ databaseMetaData.getDriverName());
|
||||||
|
_logger.debug("DriverVersion : "
|
||||||
|
+ databaseMetaData.getDriverVersion());
|
||||||
_logger.debug("");
|
_logger.debug("");
|
||||||
_logger.debug("DBMS URL : " + databaseMetaData.getURL());
|
_logger.debug("DBMS URL : "
|
||||||
_logger.debug("UserName : " + databaseMetaData.getUserName());
|
+ databaseMetaData.getURL());
|
||||||
_logger.debug(
|
_logger.debug("UserName : "
|
||||||
"----------------------------------------------------------------------------------------------------");
|
+ databaseMetaData.getUserName());
|
||||||
|
_logger.debug("-----------------------------------------------------------");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -129,13 +141,15 @@ public class InitApplicationContext extends HttpServlet {
|
|||||||
*/
|
*/
|
||||||
public void listProperties() {
|
public void listProperties() {
|
||||||
if (applicationContext.containsBean("propertySourcesPlaceholderConfigurer")) {
|
if (applicationContext.containsBean("propertySourcesPlaceholderConfigurer")) {
|
||||||
_logger.debug(
|
_logger.trace("-----------------------------------------------------------");
|
||||||
"----------------------------------------------------------------------------------------------------");
|
_logger.trace("List Properties Variables ");
|
||||||
_logger.debug("List Properties Variables ");
|
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer =
|
||||||
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = ((PropertySourcesPlaceholderConfigurer) applicationContext
|
((PropertySourcesPlaceholderConfigurer) applicationContext
|
||||||
.getBean("propertySourcesPlaceholderConfigurer"));
|
.getBean("propertySourcesPlaceholderConfigurer"));
|
||||||
properties = (Properties) propertySourcesPlaceholderConfigurer.getAppliedPropertySources()
|
properties = (Properties) propertySourcesPlaceholderConfigurer
|
||||||
.get(PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME).getSource();
|
.getAppliedPropertySources()
|
||||||
|
.get(PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME)
|
||||||
|
.getSource();
|
||||||
Set<Object> keyValue = properties.keySet();
|
Set<Object> keyValue = properties.keySet();
|
||||||
SortedSet<String> keyValueSet = new TreeSet<String>();
|
SortedSet<String> keyValueSet = new TreeSet<String>();
|
||||||
// sort key
|
// sort key
|
||||||
@ -146,10 +160,9 @@ public class InitApplicationContext extends HttpServlet {
|
|||||||
// out
|
// out
|
||||||
for (Iterator<String> it = keyValueSet.iterator(); it.hasNext();) {
|
for (Iterator<String> it = keyValueSet.iterator(); it.hasNext();) {
|
||||||
String key = (String) it.next();
|
String key = (String) it.next();
|
||||||
_logger.debug(key + " = " + properties.get(key));
|
_logger.trace(key + " = " + properties.get(key));
|
||||||
}
|
}
|
||||||
_logger.debug(
|
_logger.trace("-----------------------------------------------------------");
|
||||||
"----------------------------------------------------------------------------------------------------");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,8 +170,7 @@ public class InitApplicationContext extends HttpServlet {
|
|||||||
* listEnvVars.
|
* listEnvVars.
|
||||||
*/
|
*/
|
||||||
public void listEnvVars() {
|
public void listEnvVars() {
|
||||||
_logger.debug(
|
_logger.debug("-----------------------------------------------------------");
|
||||||
"----------------------------------------------------------------------------------------------------");
|
|
||||||
_logger.debug("List Environment Variables ");
|
_logger.debug("List Environment Variables ");
|
||||||
Map<String, String> map = System.getenv();
|
Map<String, String> map = System.getenv();
|
||||||
SortedSet<String> keyValueSet = new TreeSet<String>();
|
SortedSet<String> keyValueSet = new TreeSet<String>();
|
||||||
@ -169,27 +181,25 @@ public class InitApplicationContext extends HttpServlet {
|
|||||||
// out
|
// out
|
||||||
for (Iterator<String> it = keyValueSet.iterator(); it.hasNext();) {
|
for (Iterator<String> it = keyValueSet.iterator(); it.hasNext();) {
|
||||||
String key = (String) it.next();
|
String key = (String) it.next();
|
||||||
_logger.debug(key + " = " + map.get(key));
|
_logger.trace(key + " = " + map.get(key));
|
||||||
}
|
}
|
||||||
_logger.debug("APP_HOME" + " = " + PathUtils.getInstance().getAppPath());
|
_logger.debug("APP_HOME" + " = " + PathUtils.getInstance().getAppPath());
|
||||||
_logger.debug(
|
_logger.debug("-----------------------------------------------------------");
|
||||||
"----------------------------------------------------------------------------------------------------");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* showLicense.
|
* showLicense.
|
||||||
*/
|
*/
|
||||||
public void showLicense() {
|
public void showLicense() {
|
||||||
_logger.info(
|
_logger.info("-----------------------------------------------------------");
|
||||||
"----------------------------------------------------------------------------------------------------");
|
|
||||||
_logger.info("+ Single Sign On ( SSO ) ");
|
_logger.info("+ Single Sign On ( SSO ) ");
|
||||||
_logger.info("+ MaxKey Version "+properties.getProperty("application.formatted-version"));
|
_logger.info("+ MaxKey Version "
|
||||||
|
+ properties.getProperty("application.formatted-version"));
|
||||||
_logger.info("");
|
_logger.info("");
|
||||||
_logger.info("+ Apache License 2.0");
|
_logger.info("+ Apache License 2.0");
|
||||||
_logger.info("+ https://shimingxy.github.io/MaxKey/");
|
_logger.info("+ https://shimingxy.github.io/MaxKey/");
|
||||||
_logger.info("+ email:shimingxy@163.com");
|
_logger.info("+ email:shimingxy@163.com");
|
||||||
_logger.info(
|
_logger.info("-----------------------------------------------------------");
|
||||||
"----------------------------------------------------------------------------------------------------");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,6 +73,7 @@ import org.opensaml.saml2.metadata.impl.SurNameBuilder;
|
|||||||
import org.opensaml.saml2.metadata.impl.TelephoneNumberBuilder;
|
import org.opensaml.saml2.metadata.impl.TelephoneNumberBuilder;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.core.io.FileSystemResource;
|
||||||
|
|
||||||
import java.security.KeyStore;
|
import java.security.KeyStore;
|
||||||
|
|
||||||
@ -118,7 +119,7 @@ public void samlmtest(){
|
|||||||
try {
|
try {
|
||||||
KeyStoreLoader keyStoreLoader=new KeyStoreLoader();
|
KeyStoreLoader keyStoreLoader=new KeyStoreLoader();
|
||||||
keyStoreLoader.setKeystorePassword("secret");
|
keyStoreLoader.setKeystorePassword("secret");
|
||||||
keyStoreLoader.setKeystoreFile("D:/JavaIDE/cert/idp-keystore.jks");
|
keyStoreLoader.setKeystoreFile(new FileSystemResource("D:/JavaIDE/cert/idp-keystore.jks"));
|
||||||
keyStoreLoader.afterPropertiesSet();
|
keyStoreLoader.afterPropertiesSet();
|
||||||
KeyStore trustKeyStore =keyStoreLoader.getKeyStore();
|
KeyStore trustKeyStore =keyStoreLoader.getKeyStore();
|
||||||
|
|
||||||
|
|||||||
@ -6,14 +6,14 @@
|
|||||||
<appenders>
|
<appenders>
|
||||||
|
|
||||||
<Console name="consolePrint" target="SYSTEM_OUT">
|
<Console name="consolePrint" target="SYSTEM_OUT">
|
||||||
<PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss,SSS} [%t] %-5level %logger{36} - %msg%n" />
|
<PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss,SSS} %-5level [%t] %logger{36}:%L - %msg%n" />
|
||||||
</Console>
|
</Console>
|
||||||
|
|
||||||
<!-- 输出到文件,按天或者超过128MB分割 -->
|
<!-- 输出到文件,按天或者超过128MB分割 -->
|
||||||
<RollingFile name="RollingFile" fileName="logs/maxkey_mgt.log" filePattern="logs/$${date:yyyyMMdd}/maxkey-%d{yyyy-MM-dd}-%i.log.gz">
|
<RollingFile name="RollingFile" fileName="logs/maxkey_mgt.log" filePattern="logs/$${date:yyyyMMdd}/maxkey-%d{yyyy-MM-dd}-%i.log.gz">
|
||||||
<!-- 需要记录的级别 -->
|
<!-- 需要记录的级别 -->
|
||||||
<!-- <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY" /> -->
|
<!-- <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY" /> -->
|
||||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%F:%L) - %m%n" />
|
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5level [%t] (%logger{36}:%L) - %msg%n" />
|
||||||
<Policies>
|
<Policies>
|
||||||
<OnStartupTriggeringPolicy />
|
<OnStartupTriggeringPolicy />
|
||||||
<TimeBasedTriggeringPolicy />
|
<TimeBasedTriggeringPolicy />
|
||||||
|
|||||||
@ -6,14 +6,14 @@
|
|||||||
<appenders>
|
<appenders>
|
||||||
|
|
||||||
<Console name="consolePrint" target="SYSTEM_OUT">
|
<Console name="consolePrint" target="SYSTEM_OUT">
|
||||||
<PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss,SSS} [%t] %-5level %logger{36} - %msg%n" />
|
<PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss,SSS} %-5level [%t] %logger{36}:%L - %msg%n" />
|
||||||
</Console>
|
</Console>
|
||||||
|
|
||||||
<!-- 输出到文件,按天或者超过128MB分割 每天进行归档yyyy-MM-dd -->
|
<!-- 输出到文件,按天或者超过128MB分割 每天进行归档yyyy-MM-dd -->
|
||||||
<RollingFile name="RollingFile" fileName="logs/maxkey.log" filePattern="logs/$${date:yyyyMMdd}/maxkey-%d{yyyy-MM-dd}-%i.log.gz">
|
<RollingFile name="RollingFile" fileName="logs/maxkey.log" filePattern="logs/$${date:yyyyMMdd}/maxkey-%d{yyyy-MM-dd}-%i.log.gz">
|
||||||
<!-- 需要记录的级别 -->
|
<!-- 需要记录的级别 -->
|
||||||
<!-- <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY" /> -->
|
<!-- <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY" /> -->
|
||||||
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%F:%L) - %m%n" />
|
<PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss,SSS} %-5level [%t] %logger{36}:%L - %msg%n" />
|
||||||
<Policies>
|
<Policies>
|
||||||
<OnStartupTriggeringPolicy />
|
<OnStartupTriggeringPolicy />
|
||||||
<TimeBasedTriggeringPolicy />
|
<TimeBasedTriggeringPolicy />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user