com.base4j.mvc.auth.CustomInvocationSecurityMetadataSourceService Maven / Gradle / Ivy
package com.base4j.mvc.auth;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource;
import java.util.Collection;
//@Service
public class CustomInvocationSecurityMetadataSourceService implements FilterInvocationSecurityMetadataSource {
@Override
public Collection getAttributes(Object object) throws IllegalArgumentException {
return null;
}
@Override
public Collection getAllConfigAttributes() {
return null;
}
@Override
public boolean supports(Class> clazz) {
return false;
}
// private static Map> resourceMap = null;
//
// @Override
// public Collection getAttributes(Object object) throws IllegalArgumentException {
// System.out.println("nwuidhwuiehdfu");
// // object 是一个URL,被用户请求的url。
// FilterInvocation filterInvocation = (FilterInvocation) object;
// if (resourceMap == null) {
// loadResourceDefine();
// }
// Iterator ite = resourceMap.keySet().iterator();
// while (ite.hasNext()) {
// String resURL = ite.next();
// RequestMatcher requestMatcher = new AntPathRequestMatcher(resURL);
// if (requestMatcher.matches(filterInvocation.getHttpRequest())) {
// return resourceMap.get(resURL);
// }
// }
//
// return null;
// }
//
// @Override
// public Collection getAllConfigAttributes() {
// return new ArrayList();
// }
//
// @Override
// public boolean supports(Class> clazz) {
// return true;
// }
//
// /**
// * 在Web服务器启动时,提取系统中的所有权限
// */
// @PostConstruct
// private void loadResourceDefine() {
// List