mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
OpenSearch
- improve logging - support for specifying search locale - fix some minor authentication issues git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4713 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -51,6 +51,7 @@ public class APIServiceRegistry
|
||||
{
|
||||
// retrieve service authenticator
|
||||
MethodInterceptor authenticator = (MethodInterceptor)appContext.getBean("web.api.Authenticator");
|
||||
MethodInterceptor serviceLogger = (MethodInterceptor)appContext.getBean("web.api.ServiceLogger");
|
||||
|
||||
// register all API Services
|
||||
// NOTE: An API Service is one registered in Spring which is of type APIServiceImpl
|
||||
@@ -70,19 +71,31 @@ public class APIServiceRegistry
|
||||
}
|
||||
|
||||
// wrap API Service in appropriate interceptors (e.g. authentication)
|
||||
if (service.getRequiredAuthentication() != APIRequest.RequiredAuthentication.None)
|
||||
if (serviceLogger != null && authenticator != null)
|
||||
{
|
||||
if (authenticator == null)
|
||||
ProxyFactory authFactory = new ProxyFactory((APIService)service);
|
||||
|
||||
// authentication
|
||||
if (service.getRequiredAuthentication() != APIRequest.RequiredAuthentication.None)
|
||||
{
|
||||
throw new APIException("Web API Authenticator not specified");
|
||||
if (authenticator == null)
|
||||
{
|
||||
throw new APIException("Web API Authenticator not specified");
|
||||
}
|
||||
RegexpMethodPointcutAdvisor advisor = new RegexpMethodPointcutAdvisor(".*execute", authenticator);
|
||||
authFactory.addAdvisor(advisor);
|
||||
}
|
||||
|
||||
// logging
|
||||
if (serviceLogger != null)
|
||||
{
|
||||
RegexpMethodPointcutAdvisor advisor = new RegexpMethodPointcutAdvisor(".*execute", serviceLogger);
|
||||
authFactory.addAdvisor(advisor);
|
||||
}
|
||||
|
||||
RegexpMethodPointcutAdvisor advisor = new RegexpMethodPointcutAdvisor(".*execute", authenticator);
|
||||
ProxyFactory authFactory = new ProxyFactory((APIService)service);
|
||||
authFactory.addAdvisor(advisor);
|
||||
service = (APIService)authFactory.getProxy();
|
||||
}
|
||||
|
||||
|
||||
// register service
|
||||
methods.add(method);
|
||||
uris.add(httpUri);
|
||||
|
Reference in New Issue
Block a user