Name: grails-spring-security-oauth2
Owner: Grails Plugins
Description: Spring security Oauth Grails 3 plugin
Created: 2018-05-02 15:22:30.0
Updated: 2018-05-08 18:51:38.0
Pushed: 2018-05-08 19:13:47.0
Homepage: null
Size: 453
Language: Groovy
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Main differences with the Grails 2 plugin:
Add the following dependencies in build.gradle
ndencies {
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
ls:
plugin:
springsecurity:
oauth2:
active: true #whether the whole plugin is active or not
registration:
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:
ic hasMany = [oAuthIDs: OAuthID]
to your user domain class.
List of known extension
grails create-plugin spring-security-oauth2-myProvider
build.gradle
:provided 'org.grails.plugins:spring-security-core:3.+'
provided 'org.grails.plugins:spring-security-oauth2:1.1.+'
OAuth2AbstractProviderService
and implement the abstract methods. You can override the other methods for fine-tuning if needed.Apache 2