---
title: "How to control access to a Berlioz site using the Deck"
source: https://dev.pageseeder.com/get_started/tutorials/how_to_secure_berlioz_sites.html
description: "use Deck to control access"
last_updated: 2026-08-07T17:09:54+10:00
tokens: ~1337
---

# How to control access to a Berlioz site using the Deck

| Property | Value |
| --- | --- |
| Skills required | XML,XSL |
| Time required (minutes) | 30 |
| Intended audience | Developer |
| Difficulty | Medium |
| Category | Berlioz |

## Objective

Using the permission model and account management of PageSeeder is a straightforward way of managing user access to a [Berlioz](../../reference/glossary/berlioz.md) site. This task is made simpler by a module called **Deck** (a companion to **[Bridge](../../reference/glossary/bridge.md)**).

Essentially Deck enables the co-opting of a PageSeeder group, by a Berlioz site, in order to provide user management and authentication. The Berlioz site can be either local or remote to the PageSeeder server.

How the user accounts are administrated is a decision for the person managing the site. PageSeeder has native user interfaces for recovering lost passwords, creating accounts or adding members to a group. The same functionality is accessible through the [Service API](../../api.md). Whether to use the inbuilt interfaces, develop your own, or use a hybrid approach, is more likely a question of requirements for user experience and available developer resources rather than a technical question.

By the end of this tutorial, the student should be able to configure a PageSeeder group to manage user access to a Berlioz website.

## Tutorial

### Prepare the components

Install a Berlioz base.

To keep this exercise simple, consider running the web site on the same server as PageSeeder.

[http://hg.pageseeder.com.au/psberlioz-base/](http://hg.pageseeder.com.au/psberlioz-base)

### Define the security filter:

Go to

```

WebContent/WEB-INF/Web.xml
```

Under `<web-app>` element, define a `<filter>` element as follows:

```xml

<filter>
  <filter-name>SecurityFilter</filter-name>
  <filter-class>com.weborganic.deck.servlet.SecurityFilter</filter-class>
</filter>
```

Under the `<filter>` element, create a `<filter-mapping>` element as follows:

```xml

<filter-mapping>
  <filter-name>SecurityFilter</filter-name>
  <url-pattern>*.html</url-pattern>
</filter-mapping>
```

Reference: [Introduction to Web Application Deployment Descriptors](https://docs.oracle.com/cd/E19226-01/820-7627/bncbj/index.html)

### Berlioz configuration

Open the following file:

```

WebContent/WEB-INF/config/config-[mode].xml
```

Under the `<global>` element, define the configuration of the `<deck>` element.

```xml

<deck api-url="[PageSeeder API URL eg: http://example.org:8282/]">
  <authenticator type="pageseeder" member-of="dev-*" />
</deck>
```

Use attribute `@member-of` to define which PageSeeder group to authenticate the account against.

### Define the login servlet

Open

```

WebContent/WEB-INF/Web.xml
```

Under the `<webb-app>` element, define the `<servlet>` element as follows:

```xml

<servlet>
  <servlet-name>LoginServlet</servlet-name>
  <servlet-class>com.weborganic.deck.servlet.LoginServlet</servlet-class>
  <init-param>
    <param-name>login-page</param-name>
    <param-value>/login.html</param-value>
  </init-param>
  <init-param>
    <param-name>default-target</param-name>
    <param-value>/home.html</param-value>
  </init-param>
</servlet>
```

Define `<servlet-mapping>`

```xml

<servlet-mapping>
  <servlet-name>LoginServlet</servlet-name>
  <url-pattern>/login</url-pattern>
</servlet-mapping>
```

Reference: [Introduction to Web Application Deployment Descriptors](https://docs.oracle.com/cd/E19226-01/820-7627/bncbj/index.html)

### Define a Berlioz service

Open the following file:

```

WebContent/WEB-INF/config/services.xml
```

Under the `<service-config>` element, define a `<service>` element as follows:

```xml

<service id="login" method="get">
  <url pattern="/login" />
  <generator class="org.weborganic.berlioz.generator.NoContent" 
             name="login" 
             target="main" />
</service>
```

### Use XSL to create a login page

Go to the following folder:

```

WebContent/WEB-INF/xslt/html/default
```

Create a file called `login.xsl` then copy and paste the following code into the file and save it:

```xml

<!-- Display the login page -->
<xsl:template match="content[@name='login']" mode="content">
<xsl:variable name="login-failed"
 select="//http-parameters/parameter[@name='message']"/>

<div class="panel">
  <div id="body-{/root/header/service}">
    <form action="/login" method="post">
     <div class="input-field email">
       <input type="email"
              name="username"
              id="username"
              placeholder="Email"
              maxlength="100"
              required="required"/>
      </div>
   <div class="input-field password">
      <input type="password"
             name="password"
             id="password"
             placeholder="Password"
             maxlength="100"
             required="required"/>
      </div>
    <xsl:if test="string($login-failed) !=''">
          <xsl:value-of select="$login-failed"/>
        </xsl:if>
      <div class="input-field submit">
        <input type="submit"
             value="Login"/>
      </div>
    </form>
   </div>
 </div>
</xsl:template>
```

Open the following file:

```

WebContent/WEB-INF/xslt/html/default.xsl
```

Import the newly created file as the following.

```xml

<xsl:import href="default/login.xsl"/>
```

