////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////

[[core-gettingStarted]]
== Quick Start Guide

Getting started with the plugin is simple and efficient. Follow these steps to enhance the security of your Grails application:

.Step 1: Install the Plugin

Begin by installing the Spring Security plugin into your Grails project. Add the following dependency to your `build.gradle`:

[source,gradle,subs="+attributes"]
----
implementation 'org.apache.grails:grails-spring-security'
----

.Step 2: Run the Initialization Script

After installation, execute the `s2-quickstart` initialization script. This sets up essential classes and configurations required for the plugin's functionality. In your terminal, run:

[source,bash]
----
./gradlew runCommand -Pargs="s2-quickstart com.yourapp User Role"
----

If you are installing into a Grails plugin instead of an application, you must make sure you are using  the `web-plugin` profile. Otherwise dependencies will not be met.
Running the same command will inject the spring beans into your `GrailsPlugin` classes `doWithSpring` method.

=== Plugin Configuration and Setup

The Spring Security plugin streamlines configuration and setup through a combination of steps:

1. **Programmatic Servlet API Configuration:**

   Unlike earlier versions that utilized `web.xml`, the plugin now registers its servlet API configuration, including the Spring Security filter chain, programmatically.

2. **Configure Spring Beans:**

   The plugin configures Spring beans within the application context to implement various functionality components. Dependency management automatically handles the selection of appropriate jar files.

By following these steps, your Grails application will be ready to leverage the Spring Security plugin for enhanced security. While in-depth knowledge of Spring Security isn't mandatory, having a basic understanding of its underlying implementation can be helpful. For more details, refer to the [Spring Security documentation](https://{springSecurityHtmlSingleUrl}).
