9. Scaffolding Spring Security

PROBLEM

Security is an important part of a web application, and Spring Security provides a set of security services that integrate with Spring-based applications. Spring Security offers a lot of options, but it can be difficult to quickly get a project bootstrapped with Spring Security.

SOLUTION

Skyway Builder Standard Edition has a development accelerator for bootstrapping a project with Spring Security.

HOW IT WORKS

Here are the steps for using the Spring Security scaffolding:

Steps for scaffolding Spring Security:

  1. Right-click on the Spring DSL project, and select Scaffolding --> Scaffold Spring Security

  2. Select a model package to store the Spring Security artifacts

Skyway Builder will configure the application for Spring Security, which includes:

Spring Security scaffolding:

  1. Create a User domain object and UserDAO for storing user credentials. These artifacts can be further customized using Spring DSL if needed.

  2. Create a Authorities domain object and AuthoritiesDAO for storing authorization data. These artifacts can be further customized using Spring DSL if needed.

  3. Enable Spring security in the Security Settings section of the Enterprise Configuration tab.

  4. Configure Secured URLs in the Security Settings section of the Enterprise Configuration tab.

  5. Configure Secured Services in the Security Settings section of the Enterprise Configuration tab.

  6. Configure Secured Data Access Objects in the Security Settings section of the Enterprise Configuration tab.

  7. Configure Security Views in the Security Settings section of the Enterprise Configuration tab, including login, login success, login failure, logout success, and access denied views.

  8. Configure Security Information Sources in the Security Settings section of the Enterprise Configuration tab, including database configuration with queries for AuthoritiesDAO and UserDAO.

  9. Create dedicated Spring Security context files: project-security-context.xml, generated-project-security-context.xml

While Skyway Builder can fully setup Spring Security in a project with a few seconds, the configuration is setup to enable further customization using Spring DSL. See Securing Applications - Authentication and Securing Applications - Authorization.

RELATED RECIPES

  1. Securing Applications - Authentication

  2. Securing Applications - Authorization