Permalink
Browse files

Upgrade to version 0.2 of Shiro OAuth plugin.

This allows for multi-provider support and both Facebook and Google authentication have been added to the app.
  • Loading branch information...
1 parent a68308b commit 201920a5c9e70fc771c73a501ff852a351742af1 @pledbrook pledbrook committed Apr 29, 2012
View
@@ -1,7 +1,6 @@
#Grails Metadata file
-#Wed Apr 04 11:41:42 BST 2012
+#Sat Apr 28 15:50:02 BST 2012
app.grails.version=2.0.3
app.name=site
app.servlet.version=2.4
-app.version=1.2.9
-plugins.svn=1.0.1
+app.version=1.3-SNAPSHOT
@@ -42,14 +42,14 @@ grails.project.dependency.resolution = {
":greenmail:1.2.2",
":hibernate:$grailsVersion",
":jquery:1.6.1.1",
- ":mail:1.0-SNAPSHOT",
+ ":mail:1.0",
":pretty-time:0.3",
":quartz:0.4.2",
":resources:1.1.6",
":screencasts:0.5.6",
":searchable:0.6.3",
- ":shiro:1.2.0-SNAPSHOT",
- ":shiro-oauth:0.1",
+ ":shiro:1.1.3",
+ ":shiro-oauth:0.2",
":simple-blog:0.1.5",
":springcache:1.3.1",
":spring-events:1.2",
@@ -130,9 +130,38 @@ myAuth.applicationName = grails.org
"""
oauth {
- provider = org.scribe.builder.api.TwitterApi
- successUri = '/oauth/success?provider=twitter'
- failureUri = '/unauthorized'
+ providers {
+ twitter {
+ api = org.scribe.builder.api.TwitterApi
+ successUri = '/oauth/success?provider=twitter'
+ failureUri = '/unauthorized'
+ key = 'twitter-key'
+ secret = 'twitter-secret'
+ callback = "http://localhost:8080/oauth/twitter/callback"
+ }
+ facebook {
+ api = org.scribe.builder.api.FacebookApi
+ successUri = '/oauth/success?provider=facebook'
+ failureUri = '/unauthorized'
+ key = 'google-key'
+ secret = 'google-secret'
+ callback = "http://localhost:8080/oauth/google/callback"
+ }
+ google {
+ api = org.scribe.builder.api.GoogleApi
+ successUri = '/oauth/success?provider=google'
+ failureUri = '/unauthorized'
+ scope = 'https://www.googleapis.com/auth/userinfo.email'
+ key = 'google-key'
+ secret = 'google-secret'
+ callback = "http://localhost:8080/oauth/google/callback"
+ }
+// github {
+// api = org.scribe.builder.api.GitHubApi
+// successUri = '/oauth/success?provider=facebook'
+// failureUri = '/unauthorized'
+// }
+ }
}
security {
@@ -176,7 +176,6 @@ class UserController {
session.removeAttribute ACCOUNT_SESSION_KEY
def token = session["shiroAuthToken"]
- println "Access token: ${session.oasAccessToken.rawResponse}"
[login: cmd?.login ?: token.principal, email: cmd?.email, bean: cmd]
}
@@ -193,7 +192,6 @@ class UserController {
forward controller: "shiroOAuth", action: "linkAccount", params: [userId: userId]
}
catch (AuthenticationException ex) {
- println ">> Authentication failed: ${ex.message}"
cmd.errors.reject "auth.invalid.login", "Username or password is invalid"
redirectToAskToLinkPage cmd
}
@@ -5,7 +5,7 @@
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
<head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="robots" content="NOODP">
<meta name="Description" content="Grails is a high-productivity web framework based on the Groovy language that embraces the coding by convention paradigm, but is designed specifically for the Java platform.">
@@ -41,7 +41,7 @@
</g:form>
</g:else>
<div>
- Or <oauth:connect>log in with Twitter</oauth:connect>
+ Or log in with <oauth:connect provider="twitter">Twitter</oauth:connect> - <oauth:connect provider="facebook">Facebook</oauth:connect> - <oauth:connect provider="google">Google</oauth:connect>
</div>
<div>

0 comments on commit 201920a

Please sign in to comment.