OverviewWhen it comes to access control, Orbeon Forms leverages and delegates as much as possible to your existing security infrastructure:
$fr-roles in the in the visibility and read-only XPath expressions of the Form Builder control validation dialog. You can make a control non-visible to the current user by defining a visibility expression that returns false. If the control is visible, you can make it read-only to current user by defining a read-only expression that returns true. The rest of this page focuses on form-level access control.Accessing the username and roles[SINCE: 2011-05-18]
Access control for deployed formsWith Orbeon Forms 3.9You control access to forms entirely based on paths. For this discussion, let's assume that:
Given this, here is how paths will look like:
Now, consider the following access rules you might want to put in place:
With Orbeon Forms 4.0[SINCE 2011-07-22]You can restrict which users can access forms you create in Form Builder and what operations they can perform. Those restrictions apply to the forms you create once they are deployed, not to editing those forms in Form Builder (for the latter, see the section that follows: Access control for editing forms). Access control is role-based: you define what roles users must have to perform certain operations. By default, no restriction is imposed on who can do what with forms you create in Form Builder. You enable role-based permissions by going to the Form Builder sidebar, and under Advanced, clicking on Set Permissions. This shows the following dialog: After you click on the checkbox, you'll be able to set access restriction on the create, read, update, and delete permissions. On the first line, set the operations allowed to all the users who can access the form. You can also add lines, to grant more rights to users with specific roles. For instance, the following configuration, authorizes:
Which operations the current user can perform drives what page they can access, and on some pages which buttons are shown:
[LIMITATION] Role-based permissions you set in Form Builder can only be driven by container-based roles. At this point it doesn't support header-driven roles, ignoring the value of the oxf.fr.authentication.method property.Access control for editing formsAccess to Form Builder as a whole
Given the assumptions made in the previous section, the paths used by Form Builder look as follows: |
| Path |
Description |
/orbeon/fr/orbeon/builder/new |
To create a new form. |
/orbeon/fr/orbeon/builder/edit/{id} |
To edit a form having that given, system-generated id. |
/orbeon/fr/orbeon/builder/summary |
To view all the editable forms. |
If you have multiple classes want to give access to Form Builder to one class of users, and those users are able to edit any form in any app, the you can use path-based access restrictions, as described the previous section.
Access to specific apps/forms in Form Builder
form-builder-permissions.xml
If you'd like to have multiple classes of Form Builder users where some case edit, say, form in thehr app, while other can edit forms in the sales app, then you'll want to setup the form-builder-permissions.xml file.NOTE: [SINCE 2011-09-07] The file is now called form-builder-permissions.xml file. It replaces the file called form-runner-roles.xml. For backward compatibility, form-runner-roles.xml is still supported.
In this file you map role names to applications and forms. For instance, the following tells Orbeon Forms that only users with the role
In this file you map role names to applications and forms. For instance, the following tells Orbeon Forms that only users with the role
hr-form-editor can edit or create forms in the hr app, and only users with the role sales-form-editor can edit or create forms in the sales app. As you can infer from the syntax, you could be even more specific and only give access to users with a given role to a specific form in a specific app.<roles> <role name="hr-form-editor" app="hr" form="*"/> <role name="sales-form-editor" app="sales" form="*"/></roles>Orbeon Forms can infer the roles for the current user either based on information it gets from the container or from an HTTP header. Those two cases are detailed in the following two sections. Once you've defined your
You want to use container roles if your users are setup at the application server level, with container managed security. In Tomcat, this would correspond to using a security realm, which in its simplest form gets users from Tomcat's
form-builder-permissions.xml and done the appropriate setup for container-driven or header-driven roles, as described below:- The Form Builder summary page will only show the forms users have access to.
- When they create a new form, if users don't have the right to create a form in any app, instead of seeing a text field where they can enter the application name, they will see a drop-down listing the possible application, as shown in the following screenshot:
form-builder-permissions.xml are at this point not supported; only restrictions on the app name are supported. This means that you should always use form="*". If you define a restriction on the form name, it won't be enforced at the time the form is created, allowing users to create, save, and publish a form with an undesirable name. However they then won't be able to see the form they created when going back to the summary page.Container-driven roles
[SINCE 2011-07-01]You want to use container roles if your users are setup at the application server level, with container managed security. In Tomcat, this would correspond to using a security realm, which in its simplest form gets users from Tomcat's
conf/tomcat-users.xml. To setup container-driven roles, configure your form-builder-permissions.xml as described above, then:- Enable container-driven roles — To do so, set the following property in your
properties-local.xml:
<property as="xs:string" name="oxf.fr.authentication.method" value="container"/>
- List possible roles — There is no container API for Orbeon Forms to ask for all the roles
for the current user; instead Orbeon Forms can only ask if the current
user has a specific role. Because of this, you need to list the
possible roles in the following property, which if you have
two roles
form-builder-hrandform-builder-financewill look like:
<property as="xs:string" name="oxf.fr.authentication.container.roles"
value="form-builder-hr form-builder-finance"/>
- Require authentication — You'll also want to have another role, say
form-builder, that you grant to all the users who can access Form Builder. Hence, in our example, users will have either the two rolesform-builderandform-builder-hr, or the two rolesform-builderandform-builder-finance. In Orbeon FormsWEB-INF/web.xml, add the following to require users to login to access Form Builder. This assumes that you're using basic authentication:
<security-constraint>
<web-resource-collection>
<web-resource-name>Form Builder</web-resource-name>
<url-pattern>/fr/orbeon/builder/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>form-builder</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<security-role>
<role-name>form-builder</role-name>
</security-role>
Header-driven roles
You want to use header-driven roles if you have a servlet filter, single sign-on software, or other system that sets the roles for the current user in an HTTP header. To use header-driven roles, configure your
form-builder-permissions.xml as described above, then:- Enable header-driven roles — To do so, set the following property in your
properties-local.xml:
<property as="xs:string" name="oxf.fr.authentication.method" value="header"/>
- Header name — Tell Orbeon Forms what is the name of the HTTP header that will
contain the roles for the current user. For instance, if that header is
My-Roles-Header, use:
<property as="xs:string" name="oxf.fr.authentication.header.roles" value="My-Roles-Header"/>
- LDAP-style header syntax (Optional) — The value of the header is a list of roles separated by spaces, commas, or pipes (
|). Furthermore, they can optionally be composed of properties in the form ofname=value, wherenameis specified by a configuration property, andvalueis the value of the role. This is typically useful the value if the header follows an LDAP-style syntax, for instance:cn=role1,dc=acme,dc=ch|cn=role2,dc=acme,dc=ch. If your header follows a LDAP-style syntax, set the following property to configure what "name" contains the header, which in this example iscn:
<property as="xs:string" name="oxf.fr.authentication.header.roles.property-name" value="cn"/>




