Spring Security OAuth plugin

4 votes
Dependency:
compile ":spring-security-oauth:2.1.0-RC4"

 Documentation  Source  Issues

Summary

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

Installation

Add the following to your grails-app/conf/BuildConfig

plugins {
	// …
	// last stable version is 2.0.2
	compile ':spring-security-oauth:2.0.2'
	// 2.1 is under development
	// compile ':spring-security-oauth:2.1.0-SNAPSHOT'
	compile ':spring-security-oauth-facebook:0.1'
	// …
}

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

':spring-security-oauth-google:0.1'

Description

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.

Usage for version 2.1.0 and above

From version 2.1.0, controller and view are not anymore created in the app but are available as plugin artefacts.

Please follow instructions on repository README

2.0.2 Usage

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.

Example:

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>

Extensions