So for the project I’m currently working on, prior to taking the Alfresco developers course, we had created a custom JSP page that we call from within the course of our workflow that is located at: C:\Alfresco\tomcat\webapps\share\custom. Currently anyone can access this jsp page. However, when we move the location to C:\Alfresco\tomcat\webapps\alfresco\jsp\custom, a log on is always required to acces the page, which seems strange to me. However the issue here is we do not want to allow the user access to both Share and Explorer, thus we are not looking to configure an SSO here. We’d like to only allow people of group “Manager”, or the currently logged in user from the group “Manager” to access this page, while it is located on the share side. We’ve tried adding the following into the
C:\Alfresco\tomcat\webapps\share\WEB-INF\web.xml file:
<security-constraint>
<web-resource-collection>
<web-resource-name>All</web-resource-name>
<url-pattern>/custom /*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Manager</role-name>
</auth-constraint>
</security-constraint>
But this did not work. Does anyone have a suggestion as to how we might get the desired authentication?
Thanks
Authentication in Share is controlled by the Surf framework, and specifically it is set at the page level.
The JSP page
site-index.jspprovides an example JSP-based page which processes authenticated users for you to copy, but you must also wire it in to the framework.To do this, you’ll need to create a page definition similar to the following
Add this file under
WEB-INF/classes/alfresco/site-data/pages/site-index.xml.You’ll see that the page references a template instance
my-page, which must be declared in a second XML file underWEB-INF/classes/alfresco/site-data/template-instances, e.g.The name of the template-instance XML file (without the
.xmlsuffix) must match the name specified in the page’s<template-instance>property.Lastly create a template type file
my-page.xml(this name must match the<template-type>property in the template instance file) underWEB-INF/classes/alfresco/site-data/template-types, e.g.The file
my-page.jspwill contain your JSP code. As I mention look at the core filesite-index.jspfor an example.When you have all of this working you should package up your customisations in an AMP file. You can use either Ant or Maven to do this depending on your preference.