mgt sso
This commit is contained in:
shimingxy
2019-12-02 11:55:20 +08:00
parent 40bef5723d
commit c1a82ab45b
7 changed files with 50 additions and 56 deletions

View File

@@ -93,27 +93,27 @@ public class InitApplicationContext extends HttpServlet {
public void listDataBaseVariables(){
if(applicationContext.containsBean("dataSource")){
try {
_logger.info("----------------------------------------------------------------------------------------------------");
_logger.info("List DatabaseMetaData Variables ");
_logger.debug("----------------------------------------------------------------------------------------------------");
_logger.debug("List DatabaseMetaData Variables ");
Connection connection = ((javax.sql.DataSource)applicationContext.getBean("dataSource")).getConnection();
java.sql.DatabaseMetaData databaseMetaData = connection.getMetaData();
_logger.info("DatabaseProductName : " + databaseMetaData.getDatabaseProductName());
_logger.info("DatabaseProductVersion: " + databaseMetaData.getDatabaseProductVersion());
_logger.info("DatabaseMajorVersion : " + databaseMetaData.getDatabaseMajorVersion());
_logger.info("DatabaseMinorVersion : " + databaseMetaData.getDatabaseMinorVersion());
_logger.info("supportsTransactions : " + databaseMetaData.supportsTransactions());
_logger.info("DefaultTransaction : " + databaseMetaData.getDefaultTransactionIsolation());
_logger.info("MaxConnections : " + databaseMetaData.getMaxConnections());
_logger.info("");
_logger.info("JDBCMajorVersion : " + databaseMetaData.getJDBCMajorVersion());
_logger.info("JDBCMinorVersion : " + databaseMetaData.getJDBCMinorVersion());
_logger.info("DriverName : " + databaseMetaData.getDriverName());
_logger.info("DriverVersion : " + databaseMetaData.getDriverVersion());
_logger.info("");
_logger.info("DBMS URL : " + databaseMetaData.getURL());
_logger.info("UserName : " + databaseMetaData.getUserName());
_logger.info("----------------------------------------------------------------------------------------------------");
_logger.debug("DatabaseProductName : " + databaseMetaData.getDatabaseProductName());
_logger.debug("DatabaseProductVersion: " + databaseMetaData.getDatabaseProductVersion());
_logger.debug("DatabaseMajorVersion : " + databaseMetaData.getDatabaseMajorVersion());
_logger.debug("DatabaseMinorVersion : " + databaseMetaData.getDatabaseMinorVersion());
_logger.debug("supportsTransactions : " + databaseMetaData.supportsTransactions());
_logger.debug("DefaultTransaction : " + databaseMetaData.getDefaultTransactionIsolation());
_logger.debug("MaxConnections : " + databaseMetaData.getMaxConnections());
_logger.debug("");
_logger.debug("JDBCMajorVersion : " + databaseMetaData.getJDBCMajorVersion());
_logger.debug("JDBCMinorVersion : " + databaseMetaData.getJDBCMinorVersion());
_logger.debug("DriverName : " + databaseMetaData.getDriverName());
_logger.debug("DriverVersion : " + databaseMetaData.getDriverVersion());
_logger.debug("");
_logger.debug("DBMS URL : " + databaseMetaData.getURL());
_logger.debug("UserName : " + databaseMetaData.getUserName());
_logger.debug("----------------------------------------------------------------------------------------------------");
} catch (SQLException e) {
e.printStackTrace();
}
@@ -123,8 +123,8 @@ public class InitApplicationContext extends HttpServlet {
//propertySourcesPlaceholderConfigurer
public void listProperties(){
if(applicationContext.containsBean("propertySourcesPlaceholderConfigurer")){
_logger.info("----------------------------------------------------------------------------------------------------");
_logger.info("List Properties Variables ");
_logger.debug("----------------------------------------------------------------------------------------------------");
_logger.debug("List Properties Variables ");
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = ((PropertySourcesPlaceholderConfigurer)applicationContext.getBean("propertySourcesPlaceholderConfigurer"));
Properties properties=(Properties)propertySourcesPlaceholderConfigurer.getAppliedPropertySources().get(PropertySourcesPlaceholderConfigurer.LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME).getSource();
Set<Object> keyValue = properties.keySet();
@@ -137,15 +137,15 @@ public class InitApplicationContext extends HttpServlet {
//out
for (Iterator<String> it = keyValueSet.iterator(); it.hasNext();){
String key = (String) it.next();
_logger.info(key + " = " + properties.get(key));
_logger.debug(key + " = " + properties.get(key));
}
_logger.info("----------------------------------------------------------------------------------------------------");
_logger.debug("----------------------------------------------------------------------------------------------------");
}
}
public void listEnvVars() {
_logger.info("----------------------------------------------------------------------------------------------------");
_logger.info("List Environment Variables ");
_logger.debug("----------------------------------------------------------------------------------------------------");
_logger.debug("List Environment Variables ");
Map<String, String> map = System.getenv();
SortedSet<String> keyValueSet = new TreeSet<String>();
for (Iterator<String> itr = map.keySet().iterator(); itr.hasNext();) {
@@ -155,10 +155,10 @@ public class InitApplicationContext extends HttpServlet {
// out
for (Iterator<String> it = keyValueSet.iterator(); it.hasNext();) {
String key = (String) it.next();
_logger.info(key + " = " + map.get(key));
_logger.debug(key + " = " + map.get(key));
}
_logger.info("APP_HOME" + " = " + PathUtils.getInstance().getAppPath());
_logger.info("----------------------------------------------------------------------------------------------------");
_logger.debug("APP_HOME" + " = " + PathUtils.getInstance().getAppPath());
_logger.debug("----------------------------------------------------------------------------------------------------");
}
public void showLicense(){

View File

@@ -99,6 +99,9 @@ public class LoginEndpoint {
}else {
WebContext.setAttribute(WebConstants.SPRING_PROCESS_SAVED_REQUEST, firstSavedRequest);
}
if(WebContext.isAuthenticated()){
return WebContext.redirect("/main");
}
modelAndView.setViewName("login");
return modelAndView;
}
@@ -106,11 +109,10 @@ public class LoginEndpoint {
@RequestMapping(value={"/logon.do"})
public ModelAndView logon(@ModelAttribute("authentication") BasicAuthentication authentication) {
authenticationProvider.authenticate(authentication);
if(WebContext.isAuthenticated()){
return WebContext.redirect("/main");
}else{
authenticationProvider.authenticate(authentication);
return WebContext.redirect("/login");
}
}

View File

@@ -91,7 +91,7 @@ config.support.wsfederation.logoutUrl=https://adfs.connsec.com/adfs/ls/?wa=wsign
#############################################################################
#############################################################################
config.oidc.metadata.issuer=${config.server.maxkey.uri}
config.oidc.metadata.issuer=${config.server.name}/maxkey
config.oidc.metadata.authorizationEndpoint=${config.server.maxkey.uri}/oauth/v20/authorize
config.oidc.metadata.tokenEndpoint=${config.server.maxkey.uri}/oauth/v20/token
config.oidc.metadata.userinfoEndpoint=${config.server.maxkey.uri}/api/connect/userinfo

View File

@@ -38,15 +38,15 @@
<bean id="jwtSignerValidationService" class="org.maxkey.crypto.jwt.signer.service.impl.DefaultJwtSigningAndValidationService">
<constructor-arg name="keyStore" ref="jwkSetKeyStore" />
<property name="defaultSignerKeyId" value="connsec_rsa" />
<property name="defaultSignerKeyId" value="maxkey_rsa" />
<property name="defaultSigningAlgorithmName" value="RS256" />
</bean>
<bean id="jwtEncryptionService" class="org.maxkey.crypto.jwt.encryption.service.impl.DefaultJwtEncryptionAndDecryptionService">
<constructor-arg name="keyStore" ref="jwkSetKeyStore" />
<property name="defaultAlgorithm" value="RSA1_5" />
<property name="defaultDecryptionKeyId" value="connsec_rsa" />
<property name="defaultEncryptionKeyId" value="connsec_rsa" />
<property name="defaultDecryptionKeyId" value="maxkey_rsa" />
<property name="defaultEncryptionKeyId" value="maxkey_rsa" />
</bean>
<bean id="jwtLoginService" class="org.maxkey.authn.support.jwt.JwtLoginService">
@@ -105,8 +105,8 @@
<bean id="timeBasedKeyUriFormat" class="org.maxkey.crypto.password.opt.algorithm.KeyUriFormat">
<property name="type" value="totp" />
<property name="digits" value="6" />
<property name="issuer" value="ConnSec" />
<property name="domain" value="connsec.com" />
<property name="issuer" value="maxkey" />
<property name="domain" value="maxkey.org" />
<property name="period" value="30" />
</bean>

View File

@@ -36,7 +36,7 @@
</a>
</td>
<td id="manage" nowrap>
<a target="_blank" href="<@base/>/authz/manage">
<a target="_blank" href="<@base/>/authz/maxkey_mgt">
<div style="float:right;" >&nbsp;&nbsp;<@locale code="global.text.manage"/>&nbsp;&nbsp;</div>
</a>
</td>

View File

@@ -18,7 +18,7 @@
<div>
<form method="post" type="label" autoclose="true" action="<@base/>/safe/changeExpiredPassword">
<table class="datatable" >
<table class="table table-bordered" >
<tbody>
<tr>
<th colspan="2"><@locale code="login.password.expired.tip" /></th>
@@ -26,37 +26,33 @@
<tr>
<th><@locale code="userinfo.displayName" /> :</th>
<td>
<input readonly type="text" id="displayName" name="displayName" class="required" title="" value="${model.displayName}"/>
<input readonly type="text" id="displayName" name="displayName" class="form-control" title="" value="${model.displayName}"/>
</td>
</tr>
<tr>
<th><@locale code="userinfo.username" /> :</th>
<td>
<input readonly type="text" id="username" name="username" class="required" title="" value="${model.username}"/>
<input readonly type="text" id="username" name="username" class="form-control" title="" value="${model.username}"/>
</td>
</tr>
<tr>
<th><@locale code="login.password.newPassword" />:</th>
<td>
<input type="password" id="newPassword" name="newPassword" class=" required" title="" value=""/>
<b class="orange">*</b>
<label for="newPassword"></label>
<input type="password" id="newPassword" name="newPassword" class="form-control" title="" value=""/>
</td>
</tr>
<tr>
<th><@locale code="login.password.confirmPassword" />:</th>
<td nowrap>
<input type="password" id="confirmPassword" name="confirmPassword" class="{ required: true, equalTo: '#newPassword' }" title="" value=""/>
<b class="orange">*</b>
<label for="confirmPassword"></label>
<input type="password" id="confirmPassword" name="confirmPassword" class="form-control" title="" value=""/>
</td>
</tr>
<tr>
<td colspan="2" class="center">
<input id="_method" type="hidden" name="_method" value="post"/>
<input class="button" style="width:100px" type="submit" id="submitBtn" value="<@locale code="button.text.save" />"/>
<input class="button btn btn-lg btn-primary" style="width:100px" type="submit" id="submitBtn" value="<@locale code="button.text.save" />"/>
</td>
</tr>

View File

@@ -18,7 +18,7 @@
<form method="post" type="label" autoclose="true" action="<@base/>/safe/changeInitPassword">
<table class="datatable" >
<table class="table table-bordered" >
<tbody>
<tr>
<th colspan="2"><@locale code="login.password.initial.change.tip" /></th>
@@ -26,37 +26,33 @@
<tr>
<th><@locale code="userinfo.displayName" /> :</th>
<td>
<input readonly type="text" id="displayName" name="displayName" class="required" title="" value="${model.displayName}"/>
<input readonly type="text" id="displayName" name="displayName" class="form-control" title="" value="${model.displayName}"/>
</td>
</tr>
<tr>
<th><@locale code="userinfo.username" /> :</th>
<td>
<input readonly type="text" id="username" name="username" class="required" title="" value="${model.username}"/>
<input readonly type="text" id="username" name="username" class="form-control" title="" value="${model.username}"/>
</td>
</tr>
<tr>
<th><@locale code="login.password.newPassword" />:</th>
<td>
<input type="password" id="newPassword" name="newPassword" class=" required" title="" value=""/>
<b class="orange">*</b>
<label for="newPassword"></label>
<input type="password" id="newPassword" name="newPassword" class="form-control" title="" value=""/>
</td>
</tr>
<tr>
<th><@locale code="login.password.confirmPassword" />:</th>
<td nowrap>
<input type="password" id="confirmPassword" name="confirmPassword" class="{ required: true, equalTo: '#newPassword' }" title="" value=""/>
<b class="orange">*</b>
<label for="confirmPassword"></label>
<input type="password" id="confirmPassword" name="confirmPassword" class="form-control" title="" value=""/>
</td>
</tr>
<tr>
<td colspan="2" class="center">
<input id="_method" type="hidden" name="_method" value="post"/>
<input class="button" style="width:100px" type="submit" id="submitBtn" value=" code="button.text.save" />"/>
<input class="button btn btn-lg btn-primaryk" style="width:100px" type="submit" id="submitBtn" value=" code="button.text.save" />"/>
</td>
</tr>