Control access with SAL
By now, you're well-acquainted with the environment your plugin runs in. In this section, you'll add SAL (Secure Access Layer) modules to your plugin and update the subsequent dependencies in your
pom.xml. This section includes the following concepts and instructions:
Learn more about SAL
SAL is a component library of the Atlassian development platform. SAL supplies core plugin services shared between all Atlassian applications. Since your plugin is compatible with all Atlassian applications, SAL is an apt API to use in development.
Step 1. Check that SAL modules have been added
atlas-create-refapp-plugin command has already generated
com.atlassian.sal as a dependency. In
pom.xml, look for the following dependency:
Step 2. Update
Now that you've added additional APIs to your project you'll update the
import statements as well as the body of the class.
Replace your class with the following:
The new contents of
MyPluginServletadd import statements for
LoginUriProvider. The class now checks to see if the user is logged in (if their username isn't null). If users aren't logged in,
sendRedirectwill prompt the user to log in.
You haven't yet added anything in
PluginSettingsFactory. You'll add dependencies in future steps.
Save your changes and close
Step 3. Run QuickReload to Update Changes
In order to load the changes in JIRA and verify that your
LoginUriProvider services are working with your plugin, instead of taking down the JIRA instance and restarting using atlas-run, it is quicker and easier to use QuickReload to reload the plugin.
atlas-mvn packagein the project root
adminUIto reload the plugin.
- Navigate to your running instance of JIRA in your browser.
JIRA is usually accessible at http://localhost:2990/jira/secure/Dashboard.jspa.
- Navigate to your plugin at http://localhost:2990/jira/plugins/servlet/test.
If already logged in, you should see the "Hi again! Looking good" message.
If you're not logged in, you'll be prompted to log in with your credentials (
When you click Login, you'll be redirect to the plugin as depicted earlier.
You've added SAL services to your plugin and verified that your dependencies are correctly configured. Now, create a GUI using Atlassian User Interface (AUI) resources and templates.