Skip to content
Spring security Oauth Grails 3 plugin
Branch: master
Clone or download
#12 Compare This branch is 18 commits ahead, 9 commits behind enr:master.
MatrixCrawler Merge pull request #3 from aitmanas/master
Dependency injection fix, removal of redundant 'def' keyword, additional condition to avoid exceptions in taglib
Latest commit 0017980 Dec 18, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
src fixes to tests and additional safeguard fix to taglib Sep 24, 2016
.gitignore * property fixes Jun 21, 2016
LICENSE Update Aug 14, 2016
build.gradle * fixed issue with customizable scopes Jun 21, 2016
gradlew permission access for travis Jun 21, 2016
settings.gradle * initial commit Jun 21, 2016

Spring Security OAuth2 Plugin

Build Status Download

Main differences with the Grails 2 plugin:


Add the following dependencies in build.gradle

dependencies {
    compile 'org.grails.plugins:spring-security:3.+'
    compile 'org.grails.plugins:spring-security-oauth2:1.1.0'

You will also need at least one provider extension, i.e the grails-spring-security-oauth2-google plugin Change the version to reflect the actual version you would like to use.

You can configure the following parameters in your application.yml. This is fully optional

                active: true    #whether the whole plugin is active or not
                    askToLinkOrCreateAccountUri: '/oauth2/ask' # The URI that is called to aks the user to either create a new account or link to an existing account
                    roleNames: ['ROLE_USER'] #A list of role names that should be automatically granted to an OAuth User. The roles will be created if they do not exist

Once you have an User domain class, initialize this plugin by using the init script grails init-oauth2 <domain-class-package> <user-class-name> <oauthid-class-name> In example: grails init-oauth2 com.yourapp User OAuthID That will create the domain class com.yourapp.oAuthID

Finally add:

static hasMany = [oAuthIDs: OAuthID]

to your user domain class.


List of known extension

How to create a new provider plugin

  1. Create a new plugin with grails create-plugin spring-security-oauth2-myProvider
  2. Add the following plugins as dependency in build.gradle:
    • provided 'org.grails.plugins:spring-security-core:3.+'
    • provided 'org.grails.plugins:spring-security-oauth2:1.1.+'
  3. Create a service in your plugin that extends OAuth2AbstractProviderService and implement the abstract methods. You can override the other methods for fine-tuning if needed.


Apache 2

You can’t perform that action at this time.