This repository has been archived by the owner on Mar 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,51 @@ | ||
grails-spring-security-oauth-facebook | ||
===================================== | ||
==================================== | ||
|
||
Facebook support for Grails Spring Security OAuth. | ||
Facebook extension for [Grails Spring Security OAuth][spring-security-oauth-plugin] plugin | ||
|
||
Installation | ||
------------ | ||
|
||
Add the following plugin definition to your BuildConfig: | ||
```groovy | ||
// ... | ||
plugins { | ||
// ... | ||
compile ':spring-security-oauth:2.0.2' | ||
compile ':spring-security-oauth-facebook:0.1' | ||
// ... | ||
} | ||
``` | ||
|
||
Usage | ||
----- | ||
|
||
Add to your Config: | ||
```groovy | ||
oauth { | ||
// ... | ||
providers { | ||
// ... | ||
facebook { | ||
api = org.scribe.builder.api.FacebookApi | ||
key = 'oauth_facebook_key' | ||
secret = 'oauth_facebook_secret' | ||
successUri = '/oauth/facebook/success' | ||
failureUri = '/oauth/facebook/error' | ||
callback = "${baseURL}/oauth/facebook/callback" | ||
} | ||
// ... | ||
} | ||
} | ||
``` | ||
|
||
In your view you can use the taglib exposed from this plugin and from OAuth plugin to create links and to know if the user is authenticated with a given provider: | ||
```xml | ||
<oauth:connect provider="facebook" id="facebook-connect-link">Facebook</oauth:connect> | ||
|
||
Logged with facebook? | ||
<s2o:ifLoggedInWith provider="facebook">yes</s2o:ifLoggedInWith> | ||
<s2o:ifNotLoggedInWith provider="facebook">no</s2o:ifNotLoggedInWith> | ||
``` | ||
|
||
[spring-security-oauth-plugin]: https://github.com/enr/grails-spring-security-oauth |