Git Product home page Git Product logo

cq-urlfilter's Introduction

URL Filter

By default, Sling applications allow any combination of selectors, extensions, and suffixes to be served. Our general recommendation is to solve this problem at the dispatcher, but this can be difficult to manage sometimes, largely because the allowable selectors (and extensions and suffixes) are really a property of the content type (in Sling verbiage, the resource type; in CQ verbiage, the component type), not necessarily the path (which is all the dispatcher knows about).

This filter implements a generic strategy for handling selector, extension, and suffix filtering within Sling. It is based on a Sling sample project here. That sample project does not work with CQ 5.5 because it relies on being able to read properties from resource type definition nodes (in CQ, these are cq:Component nodes). In CQ 5.5, ACLs have been put into place which prevents end-user access to these nodes.

This version of the filter uses the CQ ComponentManager to read these properties.

Configuration

Once installed, this filter needs to be configured with a set of properties. Generally, these would be set on the page component node. The properties are:

  • allowedExtensions (String[]) - one or more allowed extensions
  • allowedExtensionPattern (String) - a RegEx defining a pattern used to allow extensions
  • allowedSuffixes (String[]) - one or more allowed suffixes
  • allowedSuffixPattern (String) - a RegEx defining a pattern used to allow suffixes
  • allowedSelectors (String[]) - one or more allowed selectors
  • allowedSelectorPattern (String) - a RegEx defining a pattern used to allow selectors

The component hierarchy (i.e. sling:resourceSuperType) is respected, but there is no support for combining these properties - the first component which defines any of these properties "wins" and is used as the configuration.

A single blank property value will prevent all values for the corresponding path component from being allowed, e.g. to prevent all selectors, set allowedSelectors to "".

cq-urlfilter's People

Contributors

justinedelson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.