Sfoglia il codice sorgente

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@631 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d

administrator 11 anni fa
parent
commit
e9d53e482a

+ 11 - 0
src/main/java/com/uas/platform/b2b/dao/AuthorityDao.java

@@ -0,0 +1,11 @@
+package com.uas.platform.b2b.dao;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import com.uas.platform.b2b.model.Authority;
+
+@Repository
+public interface AuthorityDao extends JpaRepository<Authority, Long> {
+
+}

+ 11 - 0
src/main/java/com/uas/platform/b2b/dao/ResourceDao.java

@@ -0,0 +1,11 @@
+package com.uas.platform.b2b.dao;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import com.uas.platform.b2b.model.Resource;
+
+@Repository
+public interface ResourceDao extends JpaRepository<Resource, Long> {
+
+}

+ 72 - 27
src/main/java/com/uas/platform/b2b/model/Authority.java

@@ -1,49 +1,94 @@
 package com.uas.platform.b2b.model;
 
+import java.util.Set;
+
+import javax.persistence.Cacheable;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.OrderBy;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+/**
+ * 权限
+ * 
+ * @author yingp
+ *
+ */
+@Table(name = "sec$authorities")
+@Entity
+@Cacheable
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2b.model.Authority")
 public class Authority {
-	private Long auth_id;
-	private String auth_name;
-	private String auth_desc;
-	private Short enable;
-	private Short issys;
 
-	public Long getAuth_id() {
-		return auth_id;
-	}
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sec$authorities_gen")
+	@SequenceGenerator(name = "sec$authorities_gen", sequenceName = "sec$authorities_seq", allocationSize = 1)
+	@Column(name = "auth_id")
+	private Long id;
 
-	public void setAuth_id(Long auth_id) {
-		this.auth_id = auth_id;
-	}
+	/**
+	 * 权限名称
+	 */
+	@Column(name = "auth_name")
+	private String name;
+
+	/**
+	 * 权限的具体作业范围描述
+	 */
+	@Column(name = "auth_desc")
+	private String desc;
 
-	public String getAuth_name() {
-		return auth_name;
+	/**
+	 * 权限可操控的资源
+	 */
+	@ManyToMany(cascade = { CascadeType.REFRESH }, fetch = FetchType.EAGER)
+	@JoinTable(name = "sec$authorityresource", joinColumns = @JoinColumn(name = "auth_id", referencedColumnName = "auth_id"), inverseJoinColumns = @JoinColumn(name = "res_id", referencedColumnName = "res_id"))
+	@OrderBy("id")
+	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
+	private Set<Resource> resources;
+
+	public Long getId() {
+		return id;
 	}
 
-	public void setAuth_name(String auth_name) {
-		this.auth_name = auth_name;
+	public void setId(Long id) {
+		this.id = id;
 	}
 
-	public String getAuth_desc() {
-		return auth_desc;
+	public String getName() {
+		return name;
 	}
 
-	public void setAuth_desc(String auth_desc) {
-		this.auth_desc = auth_desc;
+	public void setName(String name) {
+		this.name = name;
 	}
 
-	public Short getEnable() {
-		return enable;
+	public String getDesc() {
+		return desc;
 	}
 
-	public void setEnable(Short enable) {
-		this.enable = enable;
+	public void setDesc(String desc) {
+		this.desc = desc;
 	}
 
-	public Short getIssys() {
-		return issys;
+	public Set<Resource> getResources() {
+		return resources;
 	}
 
-	public void setIssys(Short issys) {
-		this.issys = issys;
+	public void setResources(Set<Resource> resources) {
+		this.resources = resources;
 	}
+
 }

+ 0 - 40
src/main/java/com/uas/platform/b2b/model/AuthorityResource.java

@@ -1,40 +0,0 @@
-package com.uas.platform.b2b.model;
-
-public class AuthorityResource {
-	private Long id;
-	private Long auth_id;
-	private Long res_id;
-	private Short enable;
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	public Long getAuth_id() {
-		return auth_id;
-	}
-
-	public void setAuth_id(Long auth_id) {
-		this.auth_id = auth_id;
-	}
-
-	public Long getRes_id() {
-		return res_id;
-	}
-
-	public void setRes_id(Long res_id) {
-		this.res_id = res_id;
-	}
-
-	public Short getEnable() {
-		return enable;
-	}
-
-	public void setEnable(Short enable) {
-		this.enable = enable;
-	}
-}

+ 1 - 1
src/main/java/com/uas/platform/b2b/model/Enterprise.java

@@ -33,7 +33,7 @@ import com.uas.platform.core.model.Constant;
 @Entity
 @Table(name = "sec$enterprises")
 @Cacheable
-@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2b.model.Enterprise")
 public class Enterprise implements Serializable {
 
 	/**

+ 67 - 49
src/main/java/com/uas/platform/b2b/model/Resource.java

@@ -1,76 +1,94 @@
 package com.uas.platform.b2b.model;
 
+import javax.persistence.Cacheable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+
+/**
+ * 系统可请求资源
+ * 
+ * @author yingp
+ *
+ */
+@Table(name = "sec$resources")
+@Entity
+@Cacheable
+@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2b.model.Resource")
 public class Resource {
-	private Long res_id;
-	private String res_name;
-	private String res_type;
-	private String res_link;
-	private String res_desc;
-	private Short priority;
-	private Short enable;
-	private Short issys;
-
-	public Long getRes_id() {
-		return res_id;
-	}
-
-	public void setRes_id(Long res_id) {
-		this.res_id = res_id;
-	}
-
-	public String getRes_name() {
-		return res_name;
-	}
 
-	public void setRes_name(String res_name) {
-		this.res_name = res_name;
-	}
+	@Id
+	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sec$resources_gen")
+	@SequenceGenerator(name = "sec$resources_gen", sequenceName = "sec$resources_seq", allocationSize = 1)
+	@Column(name = "res_id")
+	private Long id;
 
-	public String getRes_type() {
-		return res_type;
-	}
+	/**
+	 * 资源名称
+	 */
+	@Column(name = "res_name")
+	private String name;
+	/**
+	 * 资源类型
+	 */
+	@Column(name = "res_type")
+	private String type;
+	/**
+	 * 资源请求URL链接
+	 */
+	@Column(name = "res_link")
+	private String link;
+	/**
+	 * 对资源的具体操作对象及行为的描述
+	 */
+	@Column(name = "res_desc")
+	private String desc;
 
-	public void setRes_type(String res_type) {
-		this.res_type = res_type;
+	public Long getId() {
+		return id;
 	}
 
-	public String getRes_link() {
-		return res_link;
+	public void setId(Long id) {
+		this.id = id;
 	}
 
-	public void setRes_link(String res_link) {
-		this.res_link = res_link;
+	public String getName() {
+		return name;
 	}
 
-	public String getRes_desc() {
-		return res_desc;
+	public void setName(String name) {
+		this.name = name;
 	}
 
-	public void setRes_desc(String res_desc) {
-		this.res_desc = res_desc;
+	public String getType() {
+		return type;
 	}
 
-	public Short getPriority() {
-		return priority;
+	public void setType(String type) {
+		this.type = type;
 	}
 
-	public void setPriority(Short priority) {
-		this.priority = priority;
+	public String getLink() {
+		return link;
 	}
 
-	public Short getEnable() {
-		return enable;
+	public void setLink(String link) {
+		this.link = link;
 	}
 
-	public void setEnable(Short enable) {
-		this.enable = enable;
+	public String getDesc() {
+		return desc;
 	}
 
-	public Short getIssys() {
-		return issys;
+	public void setDesc(String desc) {
+		this.desc = desc;
 	}
 
-	public void setIssys(Short issys) {
-		this.issys = issys;
-	}
 }

+ 40 - 6
src/main/java/com/uas/platform/b2b/model/Role.java

@@ -1,12 +1,20 @@
 package com.uas.platform.b2b.model;
 
 import java.io.Serializable;
+import java.util.Set;
 
+import javax.persistence.Cacheable;
+import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.OrderBy;
 import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 
@@ -14,8 +22,11 @@ import org.codehaus.jackson.annotate.JsonIgnore;
 import org.hibernate.annotations.Cache;
 import org.hibernate.annotations.CacheConcurrencyStrategy;
 
+import com.uas.platform.core.model.Constant;
+
 @Entity
 @Table(name = "sec$roles")
+@Cacheable
 @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2b.model.Role")
 public class Role implements Serializable {
 
@@ -36,6 +47,12 @@ public class Role implements Serializable {
 	@Column(name = "role_name")
 	private String name;
 
+	/**
+	 * 角色是否属于超级用户组
+	 */
+	@Column(name = "issys")
+	private Short issys;
+
 	/**
 	 * 角色详细描述
 	 */
@@ -43,9 +60,13 @@ public class Role implements Serializable {
 	private String desc;
 
 	/**
-	 * 有效
+	 * 角色拥有的权限
 	 */
-	private Short enable;
+	@ManyToMany(cascade = { CascadeType.REFRESH }, fetch = FetchType.EAGER)
+	@JoinTable(name = "sec$roleauthority", joinColumns = @JoinColumn(name = "role_id", referencedColumnName = "role_id"), inverseJoinColumns = @JoinColumn(name = "auth_id", referencedColumnName = "auth_id"))
+	@OrderBy("id")
+	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
+	private Set<Authority> authorities;
 
 	@JsonIgnore
 	public Long getId() {
@@ -72,12 +93,25 @@ public class Role implements Serializable {
 		this.desc = desc;
 	}
 
-	public Short getEnable() {
-		return enable;
+	public Short getIssys() {
+		return issys;
+	}
+
+	public void setIssys(Short issys) {
+		this.issys = issys;
 	}
 
-	public void setEnable(Short enable) {
-		this.enable = enable;
+	public Set<Authority> getAuthorities() {
+		return authorities;
+	}
+
+	public void setAuthorities(Set<Authority> authorities) {
+		this.authorities = authorities;
+	}
+
+	@JsonIgnore
+	public boolean isSys() {
+		return getIssys() != null && getIssys() == Constant.YES;
 	}
 
 }

+ 0 - 40
src/main/java/com/uas/platform/b2b/model/RoleAuthority.java

@@ -1,40 +0,0 @@
-package com.uas.platform.b2b.model;
-
-public class RoleAuthority {
-	private Long id;
-	private Long role_id;
-	private Long auth_id;
-	private Short enable;
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	public Long getRole_id() {
-		return role_id;
-	}
-
-	public void setRole_id(Long role_id) {
-		this.role_id = role_id;
-	}
-
-	public Long getAuth_id() {
-		return auth_id;
-	}
-
-	public void setAuth_id(Long auth_id) {
-		this.auth_id = auth_id;
-	}
-
-	public Short getEnable() {
-		return enable;
-	}
-
-	public void setEnable(Short enable) {
-		this.enable = enable;
-	}
-}

+ 2 - 0
src/main/java/com/uas/platform/b2b/model/User.java

@@ -3,6 +3,7 @@ package com.uas.platform.b2b.model;
 import java.io.Serializable;
 import java.util.Set;
 
+import javax.persistence.Cacheable;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -28,6 +29,7 @@ import com.uas.platform.core.model.Constant;
 
 @Entity
 @Table(name = "sec$users")
+@Cacheable
 @Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2b.model.User")
 public class User implements Serializable {
 

+ 11 - 20
src/main/java/com/uas/platform/b2b/support/CustomAccessDecisionManager.java

@@ -20,11 +20,6 @@ import org.springframework.security.core.GrantedAuthority;
  */
 public class CustomAccessDecisionManager implements AccessDecisionManager {
 
-	/**
-	 * LOGGER 日志对象
-	 */
-//	private final static Logger LOGGER = Logger.getLogger(CustomAccessDecisionManager.class);
-
 	/**
 	 * @param authentication
 	 * @param object
@@ -34,29 +29,25 @@ public class CustomAccessDecisionManager implements AccessDecisionManager {
 	 */
 	public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes)
 			throws AccessDeniedException, InsufficientAuthenticationException {
-//		LOGGER.info("CustomAccessDecisionManager.decide");
-
+		System.out.println("decide.");
 		if (null == configAttributes || configAttributes.size() == 0) {
 			return;
 		}
-
-		ConfigAttribute c = null;
-		String needRole = null;
-		for (Iterator<ConfigAttribute> iter = configAttributes.iterator(); iter.hasNext();) {
-			c = iter.next();
-
-			needRole = c.getAttribute();
-
-//			LOGGER.info("菜单访问权限:" + needRole);
+		Iterator<ConfigAttribute> iterator = configAttributes.iterator();
+		String needPermission = null;
+		while (iterator.hasNext()) {
+			ConfigAttribute configAttribute = iterator.next();
+			needPermission = configAttribute.getAttribute();
+			System.out.println("needPermission is " + needPermission);
 			for (GrantedAuthority ga : authentication.getAuthorities()) {
-//				System.out.println(ga.getAuthority());
-				if (needRole.trim().equals(ga.getAuthority())) {
+				System.out.println(ga.getAuthority());
+				if (needPermission.equals(ga.getAuthority())) {
 					return;
 				}
 			}
 		}
-
-		throw new AccessDeniedException("结束,没有权限!");
+		if (needPermission != null)
+			throw new AccessDeniedException("结束,没有 " + needPermission + " 权限!");
 	}
 
 	/**

+ 31 - 22
src/main/java/com/uas/platform/b2b/support/CustomSecurityMetadataSource.java

@@ -3,17 +3,19 @@ package com.uas.platform.b2b.support;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
+import java.util.List;
 
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.ConfigAttribute;
 import org.springframework.security.access.SecurityConfig;
 import org.springframework.security.web.FilterInvocation;
 import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource;
-import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
-import org.springframework.security.web.util.matcher.RequestMatcher;
+
+import com.uas.platform.b2b.dao.ResourceDao;
+import com.uas.platform.b2b.model.Resource;
 
 /**
  * 资源数据定义,将所有的资源和权限对应关系建立起来,即定义某一资源可以被哪些角色访问
@@ -23,26 +25,35 @@ import org.springframework.security.web.util.matcher.RequestMatcher;
  */
 public class CustomSecurityMetadataSource implements FilterInvocationSecurityMetadataSource {
 
+	@Autowired
+	private ResourceDao resourceDao;
+
 	/**
 	 * LOGGER 日志对象
 	 */
 	private final static Logger LOGGER = Logger.getLogger(CustomSecurityMetadataSource.class);
 
-	private HashMap<String, Collection<ConfigAttribute>> map = new HashMap<String, Collection<ConfigAttribute>>();
+	private HashMap<String, Collection<ConfigAttribute>> resourceMap;
 
 	/**
 	 * 加载资源,初始化资源变量
 	 * 
 	 */
 	private void loadResourceDefine() {
-		Collection<ConfigAttribute> array = new ArrayList<ConfigAttribute>(4);
-		ConfigAttribute cfg = new SecurityConfig("ROLE_USER");
-		array.add(cfg);
-		map.put("/**", array);
+		if (resourceMap == null) {
+			resourceMap = new HashMap<String, Collection<ConfigAttribute>>();
+			List<Resource> resources = resourceDao.findAll();
+			for (Resource resource : resources) {
+				Collection<ConfigAttribute> configAttributes = new ArrayList<ConfigAttribute>();
+				ConfigAttribute configAttribute = new SecurityConfig(resource.getName());
+				configAttributes.add(configAttribute);
+				resourceMap.put(resource.getLink(), configAttributes);
+			}
+		}
 	}
 
 	public CustomSecurityMetadataSource() {
-		loadResourceDefine();
+
 	}
 
 	/**
@@ -55,20 +66,18 @@ public class CustomSecurityMetadataSource implements FilterInvocationSecurityMet
 	public Collection<ConfigAttribute> getAttributes(Object object) throws IllegalArgumentException {
 
 		LOGGER.info(object);
+		if (resourceMap == null)
+			loadResourceDefine();
+		String requestUrl = getRequestPath(((FilterInvocation) object).getRequest());
+		System.out.println("请求:" + requestUrl);
+		return resourceMap.get(requestUrl);
+	}
 
-		HttpServletRequest request = ((FilterInvocation) object).getHttpRequest();
-
-		RequestMatcher matcher = null;
-		String resUrl = null;
-		for (Iterator<String> iter = map.keySet().iterator(); iter.hasNext();) {
-			resUrl = iter.next();
-			matcher = new AntPathRequestMatcher(resUrl);
-			if (null != resUrl && matcher.matches(request)) {
-				return map.get(resUrl);
-			}
-		}
-
-		return null;
+	private String getRequestPath(HttpServletRequest request) {
+		String url = request.getServletPath();
+		if (request.getPathInfo() != null)
+			url = url + request.getPathInfo();
+		return url;
 	}
 
 	/**

+ 35 - 5
src/main/java/com/uas/platform/b2b/support/CustomUserDetailsService.java

@@ -1,6 +1,8 @@
 package com.uas.platform.b2b.support;
 
-import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DataAccessException;
@@ -10,7 +12,11 @@ import org.springframework.security.core.userdetails.User;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.util.CollectionUtils;
 
+import com.uas.platform.b2b.model.Authority;
+import com.uas.platform.b2b.model.Resource;
+import com.uas.platform.b2b.model.Role;
 import com.uas.platform.b2b.service.UserService;
 
 /**
@@ -31,7 +37,7 @@ public class CustomUserDetailsService implements UserDetailsService {
 	private UserService userService;
 
 	static final String TEL_REGEXP = "^((\\(\\d{3}\\))|(\\d{3}\\-))?(13|15|18)\\d{9}$";
-	
+
 	static final String UU_REGEXP = "^\\d{4,}$";
 
 	/**
@@ -47,11 +53,10 @@ public class CustomUserDetailsService implements UserDetailsService {
 				userinfo = userService.findUserByUserEmail(username);
 			} else if (username.matches(TEL_REGEXP)) {// 手机号登录
 				userinfo = userService.findUserByUserTel(username);
-			} else if(username.matches(UU_REGEXP)){
+			} else if (username.matches(UU_REGEXP)) {
 				userinfo = userService.findUserByUserUU(Long.parseLong(username));
 			}
-			ArrayList<GrantedAuthority> array = new ArrayList<GrantedAuthority>();
-			array.add(new SimpleGrantedAuthority(ROLE_USER));
+			Collection<GrantedAuthority> array = getGrantedAuthorities(userinfo);
 			User user = new User(String.valueOf(userinfo.getUserUU()), userinfo.getUserPwd(), true, true, true, true, array);
 			currentUser.set(user);
 			return user;
@@ -59,4 +64,29 @@ public class CustomUserDetailsService implements UserDetailsService {
 			throw new UsernameNotFoundException(username + " 不存在的账号!");
 		}
 	}
+
+	private Set<GrantedAuthority> getGrantedAuthorities(com.uas.platform.b2b.model.User user) {
+		Set<GrantedAuthority> authSet = new HashSet<GrantedAuthority>();
+		Set<Role> roles = user.getRoles();
+		if (!CollectionUtils.isEmpty(roles)) {
+			for (Role role : roles) {
+				if (role.isSys()) {// 超级账号
+					authSet.add(new SimpleGrantedAuthority("/**"));
+					break;
+				}
+				Set<Authority> authorities = role.getAuthorities();
+				if (!CollectionUtils.isEmpty(authorities)) {
+					for (Authority authority : authorities) {
+						Set<Resource> resources = authority.getResources();
+						if (!CollectionUtils.isEmpty(resources)) {
+							for (Resource res : resources) {
+								authSet.add(new SimpleGrantedAuthority(res.getName()));
+							}
+						}
+					}
+				}
+			}
+		}
+		return authSet;
+	}
 }

+ 22 - 2
src/main/resources/spring/ehcache.xml

@@ -3,10 +3,30 @@
 	<diskStore path="java.io.tmpdir" />
 	<defaultCache maxElementsInMemory="10000" eternal="false"
 		timeToIdleSeconds="120" overflowToDisk="true" maxElementsOnDisk="10000000"
-		diskPersistent="false" diskExpiryThreadIntervalSeconds="120" timeToLiveSeconds="8"
-		memoryStoreEvictionPolicy="LRU" />
+		diskPersistent="false" diskExpiryThreadIntervalSeconds="120"
+		timeToLiveSeconds="8" memoryStoreEvictionPolicy="LRU" />
 	<!-- 页面缓存块 -->
 	<cache name="SimplePageCachingFilter" maxElementsInMemory="10000"
 		eternal="false" overflowToDisk="false" timeToIdleSeconds="900"
 		timeToLiveSeconds="86400" memoryStoreEvictionPolicy="LFU" />
+	<cache name="com.uas.platform.b2b.model.Authority"
+		maxElementsInMemory="50" eternal="false" overflowToDisk="false"
+		timeToIdleSeconds="900" timeToLiveSeconds="86400"
+		memoryStoreEvictionPolicy="LFU" />
+	<cache name="com.uas.platform.b2b.model.Resource"
+		maxElementsInMemory="500" eternal="false" overflowToDisk="false"
+		timeToIdleSeconds="900" timeToLiveSeconds="86400"
+		memoryStoreEvictionPolicy="LFU" />
+	<cache name="com.uas.platform.b2b.model.Role"
+		maxElementsInMemory="50" eternal="false" overflowToDisk="false"
+		timeToIdleSeconds="900" timeToLiveSeconds="86400"
+		memoryStoreEvictionPolicy="LFU" />
+	<cache name="com.uas.platform.b2b.model.User"
+		maxElementsInMemory="10000" eternal="false" overflowToDisk="false"
+		timeToIdleSeconds="900" timeToLiveSeconds="3600"
+		memoryStoreEvictionPolicy="LFU" />
+	<cache name="com.uas.platform.b2b.model.Enterprise"
+		maxElementsInMemory="10000" eternal="false" overflowToDisk="false"
+		timeToIdleSeconds="900" timeToLiveSeconds="3600"
+		memoryStoreEvictionPolicy="LFU" />
 </ehcache>