Search in sources :

Example 1 with SecurityContextProvider

use of org.springframework.beans.factory.support.SecurityContextProvider in project spring-framework by spring-projects.

the class CallbacksSecurityTests method setUp.

@Before
public void setUp() throws Exception {
    final ProtectionDomain empty = new ProtectionDomain(null, new Permissions());
    provider = new SecurityContextProvider() {

        private final AccessControlContext acc = new AccessControlContext(new ProtectionDomain[] { empty });

        @Override
        public AccessControlContext getAccessControlContext() {
            return acc;
        }
    };
    DefaultResourceLoader drl = new DefaultResourceLoader();
    Resource config = drl.getResource("/org/springframework/beans/factory/support/security/callbacks.xml");
    beanFactory = new DefaultListableBeanFactory();
    new XmlBeanDefinitionReader(beanFactory).loadBeanDefinitions(config);
    beanFactory.setSecurityContextProvider(provider);
}
Also used : SecurityContextProvider(org.springframework.beans.factory.support.SecurityContextProvider) ProtectionDomain(java.security.ProtectionDomain) AccessControlContext(java.security.AccessControlContext) XmlBeanDefinitionReader(org.springframework.beans.factory.xml.XmlBeanDefinitionReader) Permissions(java.security.Permissions) Resource(org.springframework.core.io.Resource) DefaultListableBeanFactory(org.springframework.beans.factory.support.DefaultListableBeanFactory) DefaultResourceLoader(org.springframework.core.io.DefaultResourceLoader) Before(org.junit.Before)

Aggregations

AccessControlContext (java.security.AccessControlContext)1 Permissions (java.security.Permissions)1 ProtectionDomain (java.security.ProtectionDomain)1 Before (org.junit.Before)1 DefaultListableBeanFactory (org.springframework.beans.factory.support.DefaultListableBeanFactory)1 SecurityContextProvider (org.springframework.beans.factory.support.SecurityContextProvider)1 XmlBeanDefinitionReader (org.springframework.beans.factory.xml.XmlBeanDefinitionReader)1 DefaultResourceLoader (org.springframework.core.io.DefaultResourceLoader)1 Resource (org.springframework.core.io.Resource)1