Restricting Access to Content

You may sometimes want to be able to restrict access to all or part of a publication. It may be a simple case of restricting access to registered users, or you may wish charge for access to certain content. The Content Engine's neo.xredsys.content.agreement classes provide support for this kind of functionality. They do not presuppose any particular method of access restriction, but simply provide an interface for associating an access control method with all or part of a publication.

Access control can be switched on or off per section in Web Studio, by setting the following section properties:

Is agreement required

Must be set to Yes.

Agreement information

Must specify the name of a correctly configured AgreementPartner (see below).

If these properties are correctly set, then access to the section is denied to unauthorized readers. For a description of Web Studio and how to set these properties, see here.

Access control is configured with the /neo/io/managers/AgreementManager component. To set up access control, you need to:

  • Create a Java class that implements the interface neo.xredsys.content.agreement.AgreementPartner (see Javadoc for details). The class must have a service() method that performs the required access control check and either allows or denies access.

  • Create a component from your class by adding a .properties file to one of your configuration layers (most likely the common configuration layer located in /etc/escenic/engine/common).

  • In the same configuration layer, edit the file /neo/io/managers/AgreementManager.properties and add the line:

    agreementPartner.component-name=component-path

    where:

    • component-name is the name specified in the Agreement information property of the protected sections in Web Studio.

    • component-path is the path of the component you added to the configuration layer.

    This line tells the AgreementManager to create a component called component-name based on the information it finds in component-path.properties.

Your Java class must of course also have been compiled, packaged in a JAR file and added to the Content Engine's classpath.