Spring Security OAuth plugin

3 votes
Dependency :
compile ":spring-security-oauth:2.0.2"

Documentation Source Issues


Adds OAuth-based authentication to the Spring Security plugin using the OAuth plugin. This plugin provides an OAuth realm that can easily be integratedinto existing applications and a host of utility functions to make things like "log in with Twitter" almost trivial.


Add the following to your grails-app/conf/BuildConfig
plugins {
	compile ':spring-security-oauth:2.0.2'
	compile ':spring-security-oauth-facebook:0.1'

From 2.0.2 version provider's service and token are moved into separate plugin, example:


The OAuth plugin adds quick support of popular OAuth based authentication support to your app. It depends on the Spring Security Core plugin.

After install this plugin, please first follow Spring Security Core and OAuth plugins documentation.


Once you have an user domain and configured provider names, go with:
grails s2-init-oauth [domain-class-package] [oauthid-class-name]
that creates an OAuthID class in the specified package.


grails s2-init-oauth com.yourapp OAuthID

Finally, add

static hasMany = [oAuthIDs: OAuthID]

to you user domain class and use this lines in your login view:

Need Facebook extension installed!
<oauth:connect provider="facebook" id="facebook-connect-link">Facebook</oauth:connect>

That's it!