How create my own authentication for acces to a page on Alfresco 5

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
4535992
Established Member II

How create my own authentication for acces to a page on Alfresco 5

Jump to solution

Hi i want to make usable the "repository" page only for the member of my own customize authentication.

Here my use case with the file i modified on the share webapp with my own extension module:

// ============================

// SHARE AMP

//===============================

//--------------------------------------------------------------------------------------------------

//  /src/main/resources/alfresco/web-extension/share-config-custom.xml

//--------------------------------------------------------------------------------------------------

<alfresco-config>

   <config evaluator="string-compare" condition="WebFramework">

      <web-framework>
         <defaults>
            <page-type>
               <id>page.repository</id>
               <page-instance-id>repository</page-instance-id>
            </page-type>
         </defaults>
      </web-framework>
   </config>

</alfresco-config>

//--------------------------------------------------------------------------------------------------

//  /src/main/resources/alfresco/web-extension/site-data/pages/repository.xml

//--------------------------------------------------------------------------------------------------

<?xml version='1.0' encoding='UTF-8'?>
<page>
   <title>Repository Browser</title>
   <title-id>page.repository.title</title-id>
   <description>Browse content across the whole Repository</description>
   <description-id>page.repository.description</description-id>
   <template-instance>repository</template-instance>
   <!--<authentication>user</authentication>-->
   <authentication>admin</authentication>
</page>

How you can see it' very simple i just changed the authorization level of the "repository" page from "user" to "admin", now i want to change again from "admin" to "myOwnAuthentication" like this:

//--------------------------------------------------------------------------------------------------

//  /src/main/resources/alfresco/web-extension/site-data/pages/repository.xml

//--------------------------------------------------------------------------------------------------

<?xml version='1.0' encoding='UTF-8'?>
<page>
   <title>Repository Browser</title>
   <title-id>page.repository.title</title-id>
   <description>Browse content across the whole Repository</description>
   <description-id>page.repository.description</description-id>
   <template-instance>repository</template-instance>
   <!-- MOD ABD -->
   <!--<authentication>user</authentication>-->
   <!-- END MOD ABD -->
   <!-- <authentication>admin</authentication> -->

<authentication>myOwnAuthentication</authentication>
</page>

My question is how can i develop this new "Authentication Family" " (sorry i don't know how to call it) , by name "myOwnAuthentication" and add to my share webapp ?

1 Solution

Accepted Solutions
afaust
Master

Re: How create my own authentication for acces to a page on Alfresco 5

Jump to solution

There is no way to develop / add a custom "authentication family". The values for the authentication element are defined by an enum in Java code, and as such cannot be extended / added to without patching the corresponding classes of the Surf framework. Also bear in mind that the definition of authentication on the web script descriptor does not denote any special authentication method, but only the level of user that is allowed to access the page. If you need more fine grained access control, e.g. require a very specific set of permissions in the Repository backend, you can still do your custom check in your template / web script controller JavaScript and stop / report back an unauthorised access if the user is not allowed to access the page. Alfresco already does the same thing for Sites, e.g. they check that in a controller script, not via authentication.

1 Reply
afaust
Master

Re: How create my own authentication for acces to a page on Alfresco 5

Jump to solution

There is no way to develop / add a custom "authentication family". The values for the authentication element are defined by an enum in Java code, and as such cannot be extended / added to without patching the corresponding classes of the Surf framework. Also bear in mind that the definition of authentication on the web script descriptor does not denote any special authentication method, but only the level of user that is allowed to access the page. If you need more fine grained access control, e.g. require a very specific set of permissions in the Repository backend, you can still do your custom check in your template / web script controller JavaScript and stop / report back an unauthorised access if the user is not allowed to access the page. Alfresco already does the same thing for Sites, e.g. they check that in a controller script, not via authentication.