## Lesson 6: Security

JReport Enterprise Server provides a security system that protects the resources on the server from inappropriate access by users. In addition to controlling resource-level access, the security system can control access to certain fields or certain information based on the user's role or group level information.

As an alternative to the built-in security system, an LDAP Server can be used for JReport Security. JReport provides interfaces to synchronize with a variety of LDAP servers as well as directly authenticate to an LDAP directory.

Conversely, a Security token can be passed to JReport for authentication. JReport provides an interface for authentication.

- Task 1: Create a new user
- Task 2: Enable auditing for the user
- Task 3: Assign permissions to the user

### Task 1: Create a new user

To use JReport Enterprise Server, you must have a user account, which consists of a unique user name and a password. JReport Enterprise Server verifies your identity when you type your user name and your password and then log on. If your user account has been disabled or deleted, JReport Enterprise Server prevents you from accessing the web services that JReport Enterprise Server provides, in order to ensure that only valid users can access.

JReport Enterprise Server comes with two built-in user accounts, which are admin and guest. The built-in user accounts cannot be deleted. The admin user account can neither be deleted nor disabled.

To create a user account:

1. On the JReport Administration page, click Security on the system toolbar.

2. Switch to the User tab.
3. Click the Create a New User link.

4. Complete the New User fields with any user information you would like to use and click OK to create the user.

   Although it doesn't matter for this lesson, the Publish privilege is an important aspect of user definition. Users can either be granted or denied the ability to publish reports to the JReport Enterprise Server based on the checkbox.

   Make a note of the user credentials you specified in this step so that you can access them in the remainder of this lesson.

5. The newly-created user is listed in the User tab.

   Users can be grouped. Often a set of users require the same security privileges. That is, everyone in the Sales organization can view the Sales reports. By creating a named group, you can efficiently manage the security of a set of users.

### Task 2: Enable auditing for the user

JReport Enterprise Server can record user access and management information in the log files by auditing the user.

To audit the user:

1. Locate the user you created in Task 1, and click the corresponding Auditing link in the Control column of the user table.
2. In the Auditing dialog, click the OK button to accept the supplied defaults.

   Events are recorded in the log file.

### Task 3: Assign permissions to the user

Permissions, associated with resources and folders which locate in the Public Reports folder, are the rules that are granted to users to control their access to resources and folders. The permissions include: Visible, Read, Write, Execute, Schedule, Delete, and Grant.

After you set permissions on a parent folder, new resources and subfolders created in the folder inherit these permissions. If you do not want them to inherit permissions, enable their user permissions and set their permissions separately. The resources and folders will inherit permission from their parent folder if their user permissions are not enabled.

To set, view, change, or remove resource and folder permissions, select the row with the resource to which you want to set permissions and click Edit > Properties on the Reports page of JReport Console. In the Properties dialog, click the Permission tab, then set the permissions according to your own requirements.

Users must have certain user rights and permissions to perform tasks on certain resources. Roles help you efficiently assign those user rights and permissions to users. Assigning one or more roles to users gives the users all of the user rights and permissions the roles have to perform their jobs with. A role can also be assigned to other groups or roles, and hence the groups or roles will inherit the resource and folder permissions that the roles have.

JReport Enterprise Server comes with two built-in roles, which are administrators and everyone. The built-in roles cannot be deleted.