SpringSecurityManager.java 文件源码

java
阅读 37 收藏 0 点赞 0 评论 0

项目:xap-openspaces 作者:
/**
 * Initialize the security manager using the spring security configuration.
 */
public void init(Properties properties) throws SecurityException {
    String configLocation = properties.getProperty(SPRING_SECURITY_CONFIG_LOCATION, "security-config.xml");
    if (logger.isLoggable(Level.CONFIG)) {
        logger.config("spring-security-config-location: " + configLocation + ", absolute path: " + new File(configLocation).getAbsolutePath());
    }

    /*
     * Extract Spring AuthenticationManager definition
     */
    applicationContext = new FileSystemXmlApplicationContext(configLocation);
    Map<String, AuthenticationManager> beansOfType = applicationContext.getBeansOfType(AuthenticationManager.class);
    if (beansOfType.isEmpty()) {
        throw new SecurityException("No bean of type '"+AuthenticationManager.class.getName()+"' is defined in " + configLocation);
    }
    if (beansOfType.size() > 1) {
        throw new SecurityException("More than one bean of type '"+AuthenticationManager.class.getName()+"' is defined in " + configLocation);
    }
    authenticationManager = beansOfType.values().iterator().next();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号