/**
*
*/
package com.patil.web.site.servlet;
import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import org.alfresco.web.site.servlet.SSOAuthenticationFilter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.extensions.surf.site.AuthenticationUtil;
/**
* @author basanagowda.patil
*
*/
public class Patil extends SSOAuthenticationFilter {
private static Log LOGGER = LogFactory.getLog(Patil.class);
@Override
public void doFilter(ServletRequest sreq, ServletResponse sresp,
FilterChain chain) throws IOException, ServletException {
// Get the HTTP request/response/session
HttpServletRequest req = (HttpServletRequest) sreq;
String ctuser = req.getHeader("CTUSER");
String alfrescoSystemuser = req.getHeader("X-Alfresco-Remote-User");
if(LOGGER.isDebugEnabled()){
LOGGER.debug("Getting users CTUSER " + ctuser
+ " X-Alfresco-Remote-User " + alfrescoSystemuser);
}
String user = (ctuser == null || "".equals(ctuser)) ? alfrescoSystemuser : ctuser;
if (user != null) {
AuthenticationUtil.login(req, user);
}
super.doFilter(sreq, sresp, chain);
}
}
In the web.xml you should have the entry for the custom filter
Alfresco Project Slingshot
Alfresco Project Slingshot application
org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL
true
Spring config file location
contextConfigLocation
/WEB-INF/classes/web-application-config.xml
Set HTTP cache Expires header 30 days forward for a mapping.
CacheExpiresFilter
org.alfresco.web.scripts.servlet.StaticAssetCacheFilter
Add an Expires Header 30 days forward
expires
30
MT authentication support - NOTE: does not support portlets
MTAuthentationFilter
org.alfresco.web.site.servlet.MTAuthenticationFilter
Redirects view and service URLs to the dispatcher servlet.
UrlRewriteFilter
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
Share SSO authentication support filter.
Authentication Filter
com.patil.web.site.servlet.Patil
endpoint
alfresco
CacheExpiresFilter
*.jpg
CacheExpiresFilter
*.png
CacheExpiresFilter
*.gif
CacheExpiresFilter
*.css
CacheExpiresFilter
*.js
Authentication Filter
/page/*
Authentication Filter
/p/*
Authentication Filter
/proxy/*
UrlRewriteFilter
/proxy/*
Authentication Filter
/service/*
UrlRewriteFilter
/service/*
UrlRewriteFilter
/feedservice/*
UrlRewriteFilter
/res/*
UrlRewriteFilter
/system/*
MTAuthentationFilter
/page/*
MTAuthentationFilter
/p/*
org.springframework.web.context.ContextLoaderListener
Spring Surf Dispatcher Servlet
org.springframework.web.servlet.DispatcherServlet
contextAttribute
org.springframework.web.context.WebApplicationContext.ROOT
1
Spring Surf Dispatcher Servlet
/page/*
Spring Surf Dispatcher Servlet
/p/*
60
index.jsp
500
/error500.jsp
This comment has been removed by the author.
ReplyDeleteHi, Patil!
ReplyDeleteI use your solution? but I get
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.spr$
org.springframework.extensions.surf.exception.UserFactoryException: Unable to retrieve user from repository
...
Caused by: org.json.JSONException: A JSONObject text must begin with '{' at character 47
at org.json.JSONTokener.syntaxError(JSONTokener.java:413)
at org.json.JSONObject.(JSONObject.java:180)
at org.json.JSONObject.(JSONObject.java:420)
at org.springframework.extensions.surf.support.AlfrescoUserFactory.loadUser(AlfrescoUserFactory.java:188)
... 43 more
Can ypu help me with this issue, please?
I have the same error...
ReplyDeleteI am trying to impelment sso for alfresco.I have one application.When user hits the url,it asks for credentials.Then my citeminder authenticates that user & if its authenticated successfully,citeminder will send me one token.
ReplyDeleteNow I have one other application under scope of first application which uses alfresco.When someone clicks on upload button on UI,In backend java side I want to create alfresco session using citeminder token only(no password).Is it possible.Can you give me some idea like what steps do I need to follow for this?