use of org.alfresco.service.ServiceRegistry in project alfresco-remote-api by Alfresco.
the class HTTPRequestAuthenticationFilter method init.
/**
* Initialize the filter
*
* @param config
* FitlerConfig
* @exception ServletException
*/
public void init(FilterConfig config) throws ServletException {
// Save the context
m_context = config.getServletContext();
// Setup the authentication context
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(m_context);
ServiceRegistry serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
setNodeService(serviceRegistry.getNodeService());
setAuthenticationService(serviceRegistry.getAuthenticationService());
setTransactionService(serviceRegistry.getTransactionService());
// transactional and permission-checked
setPersonService((PersonService) ctx.getBean("PersonService"));
m_authComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
httpServletRequestAuthHeaderName = config.getInitParameter("httpServletRequestAuthHeaderName");
if (httpServletRequestAuthHeaderName == null) {
httpServletRequestAuthHeaderName = "x-user";
}
this.m_authPatternString = config.getInitParameter("authPatternString");
if (this.m_authPatternString != null) {
try {
m_authPattern = Pattern.compile(this.m_authPatternString);
} catch (PatternSyntaxException e) {
logger.warn("Invalid pattern: " + this.m_authPatternString, e);
m_authPattern = null;
}
}
}
use of org.alfresco.service.ServiceRegistry in project alfresco-remote-api by Alfresco.
the class GetMethodRegressionTest method setUp.
@Before
public void setUp() throws Exception {
applicationContext = ApplicationContextHelper.getApplicationContext();
ServiceRegistry registry = (ServiceRegistry) applicationContext.getBean(ServiceRegistry.SERVICE_REGISTRY);
davHelper = (WebDAVHelper) applicationContext.getBean(WebDAVHelper.BEAN_NAME);
auditRegistry = (AuditModelRegistryImpl) applicationContext.getBean(AUDIT_REGISTRY_BEAN_NAME);
auditService = registry.getAuditService();
fileFolderService = registry.getFileFolderService();
transactionService = registry.getTransactionService();
testingMethod = new GetMethod();
mockResponse = new MockHttpServletResponse();
restartTransaction(TransactionActionEnum.ACTION_NONE);
AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());
companyHomeNodeRef = registry.getNodeLocatorService().getNode(CompanyHomeNodeLocator.NAME, null, null);
rootTestFolder = fileFolderService.create(companyHomeNodeRef, ROOT_TEST_FOLDER_NAME, ContentModel.TYPE_FOLDER).getNodeRef();
}
Aggregations