Overview
This guide explains how to integrate Gradial with Adobe Experience Manager (AEM) 6.5. AEM 6.5 supports multiple authentication methods, with OAuth 2.0 being the preferred approach for enhanced security and granular access control.Authentication Methods
AEM 6.5 supports two primary authentication methods for external integrations:OAuth 2.0 Client (Preferred)
Recommended approach offering fine-grained access control through custom OAuth scopes. Provides better security, audit trails, and permission management.
Basic Authentication
Secondary option using username/password credentials. Simpler to implement but less secure and granular than OAuth.
OAuth 2.0 is strongly recommended for production environments due to its superior security model, token-based authentication, and granular permission controls.
OAuth 2.0 Integration Steps
Basic OAuth integration includes:- Creating and configuring an OAuth client
- Defining custom OAuth scopes and assigning them appropriate permissions
- Configuring user permissions for scope access
- Granting the oauthservice user the same privileges (plus access control privileges)
- Providing Gradial with the OAuth client credentials (and private key if 2-legged OAuth)
OAuth 2.0 Technical Details
AEM supports two OAuth authentication flows:On-behalf-of (3-legged)
Tied to individual user permissions. This flow requires user authentication and consent.
Service-to-service (2-legged)
Machine-to-machine communication with no user intervention. Uses JWT tokens for authentication.
Integration Steps
1
Create an OAuth Client
- Log in as an admin or service account
- Go to
<AEM-HOST>/libs/granite/oauth/content/clients.html
, click Create - Name the client (e.g., Gradial)
- For 3-legged OAuth, set the redirect to:
https://www.gradial.com/api/v1/auth/aem65/oauth2/callback
- Obtain the Client ID and Secret and share them securely with Gradial
Always keep OAuth credentials secure and never share them in public repositories or documentation.
2
Define Custom OAuth Scopes
What are OAuth Scopes?OAuth scopes are Java classes that define specific permissions for API access. Each scope:
This example demonstrates:Example 2: Experience Fragment ScopesExample 3: Operation-Specific Scopes
- Maps to specific JCR paths in your AEM repository
- Defines the exact privileges (read, write, version management, etc.)
- Controls what operations the OAuth client can perform
- Appears in user consent dialogs during authorization
ExampleScope.java - Complete Implementation
ExampleScope.java - Complete Implementation
- Asset upload permissions to
/content/dam
- Required JCR privileges (read, write, lock management, version management)
- Proper OSGi component configuration
- User-friendly description for consent dialogs
- ReadAllScope.java: Read access to
/
for component/template definitions, dynamic media publishing, etc. - AuthorLaunchesScope.java: Create and manage launches at
/content/launches
- AuthorTagsScope.java: Create and manage tags at
/content/cq:tags
- AssetsUploadScope.java: Upload assets to
/content/dam
- AssetsPublishScope.java: Publish assets from the DAM
When You Need Custom Scopes
Multi-Site Architecture:- If your AEM instance manages multiple websites with different permission boundaries
- When authors have access to specific sites but not others
- Example: Authors for Site A can access
/content/sitea
but not/content/siteb
- Experience Fragments with site-specific access patterns
- Campaign content with restricted access
- Multi-brand environments with separate governance
- Different operations (read vs write) for different content areas
- Workflow-specific permissions (launches vs direct editing)
- Integration-specific requirements (publish vs author operations)
Scope Creation Examples
Example 1: Site-Specific Author ScopesEngineering Implementation Process
Step 1: Analyze Your Content Architecture- Map out all content paths that need different access controls
- Identify user groups and their permission boundaries
- Document required operations per content area
- Create one scope class per unique permission requirement
- Name scopes descriptively (e.g.,
SiteAAuthorScope
,SiteBExperienceFragmentScope
) - Set appropriate
RESOURCE_URI
and privilege combinations
- Create Java Classes: Base each on the ExampleScope.java template above
- Compile to OSGi Bundle: Package all scopes into a single bundle
- Deploy to AEM: Install bundle on all author instances
- Verify Registration: Check OAuth client configuration shows new scopes
- Test Access: Validate each scope grants expected permissions
- Ensure authenticating users have JCR permissions matching each scope’s RESOURCE_URI
- Update user group memberships to align with scope boundaries
- Test OAuth authorization with different user accounts
Each scope must have a corresponding user permission. If a scope grants access to
/content/sitea
but the authenticating user lacks permissions to that path, OAuth authorization will fail.This is a one-time engineering effort per AEM environment. Once scopes are deployed, they can be reused across multiple OAuth clients and integrations.
Alternative: Dynamic Scopes Package
Simplified Scope Management OptionFor organizations that prefer to avoid custom Java development, Gradial offers a pre-built dynamic scopes package that enables scope configuration through OSGi settings instead of code deployment.Benefits of Dynamic Scopes:- No Java development required
- Configure scopes via OSGi configuration files
- Update scope permissions without code deployments
- Ideal for environments with limited development resources
- Supports the same permission granularity as custom scopes
- Deploy Gradial’s dynamic scopes OSGi bundle once
- Create scope configurations using OSGi
.config
files - Define resource paths and permissions declaratively
- Manage scope changes through configuration management
Interested in Dynamic Scopes? Contact your Gradial representative to learn more about the dynamic scopes package and whether it’s suitable for your environment and requirements.
Gradial can provide additional scope templates for specific use cases if needed.
3
Configure User Permissions
Who performs this step: AEM Administrator or user with security administration privilegesOAuth scopes only work if the authenticating user has the corresponding JCR permissions. This section details the permissions required for both the authenticating user and the oauthservice system user.
Required JCR Permissions (6.5)
The authenticating user needs specific read and write permissions that match your OAuth scope definitions:Area | Path | Access Level | Why It’s Needed | How to Assign in AEM |
---|---|---|---|---|
Templates & Configs | /apps , /conf , /libs | jcr:read | Lets Gradial use components, templates, and policies | Usually covered by adding to the Contributors group |
Legacy Configs | /etc | jcr:read | Access legacy designs/workflows (only in 6.5) | If your org still stores configs in /etc , grant read to service group |
Launches | /content/launches | jcr:read , rep:write , jcr:versionManagement | Allows Gradial to create, edit, and manage Launches | Add to an Authors group, or create a custom group with Launch rights |
Site Content | /content/<your-site> | jcr:read , rep:write | Needed for creating and updating pages | Add to an Authors group for your site, or grant direct permissions |
Assets (DAM) | /content/dam/<your-dam> | jcr:read , rep:write, crx:replicate | Allows Gradial to upload assets and update metadata | Add to DAM Users group, or grant write access directly |
Tags | /content/cq:tags | jcr:read (apply existing) / rep:write (create new) | Needed for tagging and categorizing content | Create a custom group with tag write rights if not already included |
Publishing (Optional) | /content (scoped) | crx:replicate | Needed only if Gradial must activate/deactivate pages | Add only if Gradial should publish; otherwise omit |
Avoid | Any | jcr:all | Grants superuser access | Not recommended — violates least privilege |
Permission Assignment for Authenticating Users
The user who authorizes OAuth access must have permissions that match the requested scopes:- Navigate to AEM Security Console
- Go to Tools → Security → Users
- Locate the user account that will authorize OAuth access
- Assign to Author Groups
- Add the user to appropriate author groups
- Ensure the groups have permissions matching your OAuth scopes
- Verify Scope Alignment
- If your scope grants access to
/content/mysite
, ensure the user has author permissions for that path - If using asset scopes, ensure the user can upload/manage assets in the corresponding DAM folders
- If your scope grants access to
OAuth authorization will fail if the authenticating user lacks permissions for the requested scopes. The user must have at least the same permissions defined in your OAuth scope classes.
Permission Verification
Test user permissions before OAuth configuration:- Access Control Testing
- Navigate to
<AEM-HOST>:<PORT>/security/permissions.html
- Search for the user account
- Verify permissions match your OAuth scope paths
- Navigate to
- Content Access Testing
- Log in as the user and verify they can access/modify content in scope paths
- Test launch creation if using launch-based workflows
- Test asset upload if using DAM scopes
4
Configure oauthservice System User Permissions
About the oauthservice UserThe
oauthservice
is a built-in system user that AEM creates to handle OAuth token operations. This user must have enhanced permissions beyond regular users to manage access control for OAuth scopes.Required Permissions for oauthservice
The oauthservice user needs all the same permissions as your authenticating users plus additional access control privileges:Standard Permissions (same as authenticating users):- Read access to:
/apps
,/bin
,/conf
,/content
,/etc
,/home
,/libs
,/var
- Write access to:
/content/launches
,/content/dam
,/content/cq:tags
, or your specific site paths - Special permissions:
jcr:versionManagement
,jcr:lockManagement
jcr:readAccessControl
- Read permission metadata and access control listsjcr:modifyAccessControl
- Modify access control for OAuth scope validation
Permission Assignment Steps
- Access the Security Console
- Navigate to
<AEM-HOST>:<PORT>/security/permissions.html/principal/oauthservice?filter=user
- This shows current permissions for the oauthservice user
- Navigate to
- Verify Current Permissions
- Check that oauthservice has read access to all paths defined in your OAuth scopes
- Verify write access to content paths where Gradial will operate
- Add Missing Permissions
- Add any missing read/write permissions to match your OAuth scope definitions
- Ensure
jcr:readAccessControl
andjcr:modifyAccessControl
are present
- Alternative: Group-Based Assignment
- Create a dedicated “OAuth Service Users” group
- Assign all required permissions to the group
- Add oauthservice user to the group
The oauthservice user must have equal or greater permissions than your OAuth scopes grant. Missing permissions will cause OAuth authorization failures.
The oauthservice user automatically appears in AEM after the first OAuth request. If not visible, complete the OAuth client setup first.
5
Configure OAuth Server Authentication Handler
What this step does: Configures AEM to prioritize OAuth authentication over other authentication methods.
Access OSGi Configuration
- Open the Configuration Manager
- Navigate to
<AEM-HOST>:<PORT>/system/console/configMgr
- Use admin credentials to access the OSGi console
- Navigate to
- Locate the OAuth Handler
- Search for “Adobe Granite OAuth Server Authentication Handler”
- Click the configuration name to open the editor
Required Configuration Settings
Configure the following properties:Property | Value | Purpose |
---|---|---|
jaas.ranking | 1100 | Sets priority over other auth handlers |
jaas.controlFlag | sufficient | Allows OAuth to satisfy auth requirements |
oauth.offline.validation | true | Enables token validation without callbacks |
jaas.realmName | jackrabbit.oak | Specifies the security realm |
path | / | Applies OAuth to all paths |
Step-by-Step Configuration
- Set Authentication Priority
- Find
jaas.ranking
field - Enter
1100
(or higher if you have custom auth handlers with high rankings) - This ensures OAuth takes precedence over basic authentication
- Find
- Configure Control Flag
- Set
jaas.controlFlag
tosufficient
- This allows OAuth to fulfill authentication requirements independently
- Set
- Enable Offline Validation
- Check
oauth.offline.validation
totrue
- Enables token validation without requiring external callbacks
- Check
- Set Realm and Path
jaas.realmName
: Usejackrabbit.oak
(AEM’s default security realm)path
: Set to/
to apply OAuth authentication to all AEM paths
- Save Configuration
- Click “Save” to apply the changes
- The configuration takes effect immediately
Example OSGi Configuration File
For deployment automation, use this.config
file format:The “B” prefix indicates Boolean type and “I” indicates Integer type in OSGi configuration files.
Verification
After configuration:- Check that the configuration appears in the OSGi console
- Verify no error messages in the AEM error logs
- Test OAuth authentication with a simple scope request
Incorrect
jaas.ranking
values may cause OAuth authentication to be bypassed. Ensure the ranking is higher than other authentication handlers.6
Configure Service-to-Service (2-Legged)
- In the OAuth client config, click Download Private Key
- Securely provide the private key to Gradial for JWT signing
7
Testing
To test scopes, open the consent URL:You should see a bullet for each requested scope. Authorizing should return a code in the URL bar if the user has permissions to the scopes. If the user does not have permissions, it will not return a code.
Gradial can provide a separate testing guide for completing the flow to retrieve and use access tokens if needed.
Need Help?
Contact your Gradial representative for additional support with your AEM 6.5 integration.