mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-15 04:52:09 +08:00
fix
This commit is contained in:
@@ -94,7 +94,7 @@ public class ApplicationAutoConfiguration implements InitializingBean {
|
||||
if(_logger.isDebugEnabled()) {
|
||||
_logger.debug("Password Encoders :");
|
||||
for (String key : encoders.keySet()) {
|
||||
_logger.debug(key + "=" + encoders.get(key));
|
||||
_logger.debug(key + "=" + encoders.get(key).getClass().getName());
|
||||
}
|
||||
}
|
||||
_logger.debug("default encoder " + idForEncode);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class ActiveDirectoryUser {
|
||||
/*
|
||||
*常规
|
||||
* 名 First Name givenName
|
||||
* 姓 Last Name sn
|
||||
* 姓 Last Name/SurName sn
|
||||
* 英文缩写 Initials initials
|
||||
* 描述 Description description
|
||||
* 办公室 Office physicalDeliveryOfficeName
|
||||
@@ -179,13 +179,45 @@ public class ActiveDirectoryUser {
|
||||
public static final String DISTINGUISHEDNAME = "distinguishedname";
|
||||
|
||||
//MaxKey EXTEND
|
||||
/**
|
||||
* EXTEND managerName
|
||||
*/
|
||||
public static final String MANAGERNAME = "managerName";
|
||||
/**
|
||||
* EXTEND username
|
||||
*/
|
||||
public static final String USERNAME = "username";
|
||||
/**
|
||||
* EXTEND userType
|
||||
*/
|
||||
public static final String USERTYPE = "userType";
|
||||
/**
|
||||
* EXTEND gender
|
||||
*/
|
||||
public static final String GENDER = "gender";
|
||||
/**
|
||||
* EXTEND status
|
||||
*/
|
||||
public static final String USERSTATUS = "status";
|
||||
/**
|
||||
* EXTEND firstName
|
||||
*/
|
||||
public static final String FIRSTNAME = "firstName";
|
||||
/**
|
||||
* EXTEND lastName
|
||||
*/
|
||||
public static final String LASTNAME = "lastName";
|
||||
/**
|
||||
* EXTEND email
|
||||
*/
|
||||
public static final String EMAIL = "email";
|
||||
|
||||
|
||||
/**
|
||||
* encodePassword for ActiveDirectory
|
||||
* @param password
|
||||
* @return
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
public static byte[] encodePassword(String password) throws UnsupportedEncodingException {
|
||||
return ("\"" + password + "\"").getBytes("UTF-16LE");
|
||||
}
|
||||
|
||||
@@ -132,9 +132,21 @@ public class InetOrgPerson {
|
||||
public static final String MANAGER = "manager";
|
||||
|
||||
//MaxKey EXTEND
|
||||
/**
|
||||
* EXTEND department
|
||||
*/
|
||||
public static final String DEPARTMENT = "department";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* EXTEND firstName
|
||||
*/
|
||||
public static final String FIRSTNAME = "firstName";
|
||||
/**
|
||||
* EXTEND lastName
|
||||
*/
|
||||
public static final String LASTNAME = "lastName";
|
||||
/**
|
||||
* EXTEND email
|
||||
*/
|
||||
public static final String EMAIL = "email";
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import org.maxkey.util.IdGenerator;
|
||||
import org.maxkey.web.message.Message;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
import org.springframework.security.core.Authentication;
|
||||
@@ -161,13 +162,21 @@ public final class WebContext {
|
||||
* @param id
|
||||
* @return Object
|
||||
*/
|
||||
public static Object getBean(String id){
|
||||
public static Object getBean(String name){
|
||||
if(applicationContext==null) {
|
||||
return getApplicationContext().getBean(id);
|
||||
return getApplicationContext().getBean(name);
|
||||
}else {
|
||||
return applicationContext.getBean(id);
|
||||
return applicationContext.getBean(name);
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T getBean(String name, Class<T> requiredType) throws BeansException{
|
||||
if(applicationContext==null) {
|
||||
return getApplicationContext().getBean(name,requiredType);
|
||||
}else {
|
||||
return applicationContext.getBean(name,requiredType);
|
||||
}
|
||||
};
|
||||
|
||||
// below method is common HttpServlet method
|
||||
/**
|
||||
@@ -202,8 +211,8 @@ public final class WebContext {
|
||||
* http://www.website.com/webcontext
|
||||
*/
|
||||
public static String getHttpContextPath(HttpServletRequest httpServletRequest) {
|
||||
ApplicationConfig applicationConfig = (
|
||||
ApplicationConfig) WebContext.getBean("applicationConfig");
|
||||
ApplicationConfig applicationConfig =
|
||||
WebContext.getBean("applicationConfig",ApplicationConfig.class);
|
||||
|
||||
_logger.trace("Config ServerPrefix " + applicationConfig.getServerPrefix());
|
||||
_logger.trace("Config DomainName " + applicationConfig.getDomainName());
|
||||
@@ -295,7 +304,7 @@ public final class WebContext {
|
||||
* @return encoded String
|
||||
*/
|
||||
public static String encoding(String encodingString) {
|
||||
ApplicationConfig applicationConfig = (ApplicationConfig) getBean("applicationConfig");
|
||||
ApplicationConfig applicationConfig = getBean("applicationConfig",ApplicationConfig.class);
|
||||
return applicationConfig.getCharacterEncodingConfig().encoding(encodingString);
|
||||
}
|
||||
|
||||
@@ -309,7 +318,7 @@ public final class WebContext {
|
||||
Locale locale = null;
|
||||
try {
|
||||
CookieLocaleResolver cookieLocaleResolver =
|
||||
(CookieLocaleResolver) getBean("localeResolver");
|
||||
getBean("localeResolver",CookieLocaleResolver.class);
|
||||
locale = cookieLocaleResolver.resolveLocale(getRequest());
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user