Permalink
Browse files

Merged in 1.1.0.M2 changes

  • Loading branch information...
2 parents 8a6c829 + 82cc0b6 commit ed50f12ed6cf2172d786109ead716ce9737c2ee4 Craig Walls committed Feb 14, 2013
Showing with 1,650 additions and 624 deletions.
  1. +15 −14 build.gradle
  2. +1 −1 gradle.properties
  3. +2 −2 gradle/wrapper/gradle-wrapper.properties
  4. +6 −6 publish-maven.gradle
  5. +0 −1 settings.gradle
  6. +169 −0 ...al-facebook-web/src/main/java/org/springframework/social/facebook/web/CanvasSignInController.java
  7. +1 −1 ...cial-facebook-web/src/main/java/org/springframework/social/facebook/web/DisconnectController.java
  8. +2 −2 ...cial-facebook-web/src/main/java/org/springframework/social/facebook/web/FacebookCookieParser.java
  9. +1 −1 ...ocial-facebook-web/src/main/java/org/springframework/social/facebook/web/FacebookCookieValue.java
  10. +1 −1 ...ng-social-facebook-web/src/main/java/org/springframework/social/facebook/web/FacebookInitTag.java
  11. +2 −2 ...cebook-web/src/main/java/org/springframework/social/facebook/web/FacebookWebArgumentResolver.java
  12. +1 −1 spring-social-facebook-web/src/main/java/org/springframework/social/facebook/web/SignedRequest.java
  13. +12 −7 ...book-web/src/main/java/org/springframework/social/facebook/web/SignedRequestArgumentResolver.java
  14. +6 −21 ...cial-facebook-web/src/main/java/org/springframework/social/facebook/web/SignedRequestDecoder.java
  15. +2 −2 ...al-facebook-web/src/main/java/org/springframework/social/facebook/web/SignedRequestException.java
  16. +2 −2 ...al-facebook-web/src/test/java/org/springframework/social/facebook/web/DeauthorizationRequest.java
  17. +5 −5 ...-facebook-web/src/test/java/org/springframework/social/facebook/web/DisconnectControllerTest.java
  18. +1 −1 ...ebook-web/src/test/java/org/springframework/social/facebook/web/FacebookArgumentResolverTest.java
  19. +1 −1 ...ocial-facebook-web/src/test/java/org/springframework/social/facebook/web/FacebookInitTagTest.java
  20. +4 −4 ...-web/src/test/java/org/springframework/social/facebook/web/SignedRequestArgumentResolverTest.java
  21. +2 −2 ...-facebook-web/src/test/java/org/springframework/social/facebook/web/SignedRequestDecoderTest.java
  22. +1 −9 ...-facebook-web/src/test/java/org/springframework/social/facebook/web/StubConnectionRepository.java
  23. +1 −1 ...book-web/src/test/java/org/springframework/social/facebook/web/StubUsersConnectionRepository.java
  24. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Account.java
  25. +2 −2 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Album.java
  26. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Checkin.java
  27. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/CheckinPost.java
  28. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Comment.java
  29. +15 −6 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/CommentOperations.java
  30. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/EducationEntry.java
  31. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Event.java
  32. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/EventInvitee.java
  33. +50 −14 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/EventOperations.java
  34. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Facebook.java
  35. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FacebookLink.java
  36. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FacebookProfile.java
  37. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FamilyMember.java
  38. +225 −33 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FeedOperations.java
  39. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlException.java
  40. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlOperations.java
  41. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java
  42. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResultMapper.java
  43. +44 −21 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FriendOperations.java
  44. +3 −5 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/GraphApi.java
  45. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Group.java
  46. +1 −1 ...g-social-facebook/src/main/java/org/springframework/social/facebook/api/GroupMemberReference.java
  47. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/GroupMembership.java
  48. +18 −9 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/GroupOperations.java
  49. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/ImageType.java
  50. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Invitation.java
  51. +18 −20 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/LikeOperations.java
  52. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/LinkPost.java
  53. +2 −2 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/ListAndCount.java
  54. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Location.java
  55. +81 −13 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/MediaOperations.java
  56. +1 −1 ...ial-facebook/src/main/java/org/springframework/social/facebook/api/MissingNamespaceException.java
  57. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/MusicPost.java
  58. +1 −1 ...ng-social-facebook/src/main/java/org/springframework/social/facebook/api/NotAFriendException.java
  59. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/NotePost.java
  60. +1 −1 ...ng-social-facebook/src/main/java/org/springframework/social/facebook/api/OpenGraphOperations.java
  61. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Page.java
  62. +1 −1 ...l-facebook/src/main/java/org/springframework/social/facebook/api/PageAdministrationException.java
  63. +2 −4 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/PageOperations.java
  64. +43 −0 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/PagedList.java
  65. +62 −0 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/PagingParameters.java
  66. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Photo.java
  67. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/PhotoPost.java
  68. +35 −8 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/PlacesOperations.java
  69. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Post.java
  70. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Question.java
  71. +4 −6 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/QuestionOperations.java
  72. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/QuestionOption.java
  73. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Reference.java
  74. +1 −1 ...al-facebook/src/main/java/org/springframework/social/facebook/api/ResourceOwnershipException.java
  75. +2 −2 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/RsvpStatus.java
  76. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/StatusPost.java
  77. +15 −0 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/StoryTag.java
  78. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/SwfPost.java
  79. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Tag.java
  80. +3 −5 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/UserOperations.java
  81. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/Video.java
  82. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/VideoPost.java
  83. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/WorkEntry.java
  84. +1 −1 ...cebook/src/main/java/org/springframework/social/facebook/api/impl/AbstractFacebookOperations.java
  85. +13 −10 ...g-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/CommentTemplate.java
  86. +29 −19 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/EventTemplate.java
  87. +4 −4 ...ial-facebook/src/main/java/org/springframework/social/facebook/api/impl/FacebookErrorHandler.java
  88. +27 −5 ...-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/FacebookTemplate.java
  89. +183 −48 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/FeedTemplate.java
  90. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/FqlTemplate.java
  91. +32 −24 ...ng-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/FriendTemplate.java
  92. +14 −13 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/GroupTemplate.java
  93. +19 −20 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/LikeTemplate.java
  94. +2 −2 ...-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/ListDeserializer.java
  95. +39 −25 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/MediaTemplate.java
  96. +1 −1 ...social-facebook/src/main/java/org/springframework/social/facebook/api/impl/OpenGraphTemplate.java
  97. +3 −2 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/PageTemplate.java
  98. +71 −0 ...ng-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/PagedListUtils.java
  99. +19 −12 ...ng-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/PlacesTemplate.java
  100. +5 −6 ...-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/QuestionTemplate.java
  101. +15 −5 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/UserTemplate.java
  102. +1 −1 ...social-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/AccountMixin.java
  103. +1 −1 ...g-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/AlbumMixin.java
  104. +1 −1 ...social-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/CheckinMixin.java
  105. +1 −1 ...al-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/CheckinPostMixin.java
  106. +1 −1 .../main/java/org/springframework/social/facebook/api/impl/json/CommentListAndCountDeserializer.java
  107. +1 −1 ...social-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/CommentMixin.java
  108. +1 −1 ...facebook/src/main/java/org/springframework/social/facebook/api/impl/json/EducationEntryMixin.java
  109. +1 −1 ...l-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/EventInviteeMixin.java
  110. +1 −1 ...g-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/EventMixin.java
  111. +1 −1 ...cial-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/FacebookModule.java
  112. +1 −1 ...acebook/src/main/java/org/springframework/social/facebook/api/impl/json/FacebookProfileMixin.java
  113. +1 −1 ...l-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/FamilyMemberMixin.java
  114. +1 −1 ...ok/src/main/java/org/springframework/social/facebook/api/impl/json/GroupMemberReferenceMixin.java
  115. +1 −1 ...acebook/src/main/java/org/springframework/social/facebook/api/impl/json/GroupMembershipMixin.java
  116. +1 −1 ...g-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/GroupMixin.java
  117. +1 −1 ...ial-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/InvitationMixin.java
  118. +1 −1 ...ocial-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/LinkPostMixin.java
  119. +1 −1 ...ocial-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/LocationMixin.java
  120. +1 −1 ...cial-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/MusicPostMixin.java
  121. +1 −1 ...ocial-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/NotePostMixin.java
  122. +1 −1 ...ng-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/PageMixin.java
  123. +1 −1 ...g-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/PhotoMixin.java
  124. +1 −1 ...cial-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/PhotoPostMixin.java
  125. +1 −1 ...facebook/src/main/java/org/springframework/social/facebook/api/impl/json/PictureDeserializer.java
  126. +1 −1 ...ng-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/PostMixin.java
  127. +1 −1 ...ocial-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/QuestionMixin.java
  128. +1 −1 ...c/main/java/org/springframework/social/facebook/api/impl/json/QuestionOptionListDeserializer.java
  129. +1 −1 ...facebook/src/main/java/org/springframework/social/facebook/api/impl/json/QuestionOptionMixin.java
  130. +1 −1 ...ain/java/org/springframework/social/facebook/api/impl/json/ReferenceListAndCountDeserializer.java
  131. +1 −1 ...ok/src/main/java/org/springframework/social/facebook/api/impl/json/ReferenceListDeserializer.java
  132. +1 −1 ...cial-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/ReferenceMixin.java
  133. +1 −1 ...ebook/src/main/java/org/springframework/social/facebook/api/impl/json/RsvpStatusDeserializer.java
  134. +1 −1 ...ial-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/StatusPostMixin.java
  135. +15 −0 ...book/src/main/java/org/springframework/social/facebook/api/impl/json/StoryTagMapDeserializer.java
  136. +1 −1 ...ocial-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/StoryTagMixin.java
  137. +1 −1 ...social-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/SwfPostMixin.java
  138. +1 −1 ...facebook/src/main/java/org/springframework/social/facebook/api/impl/json/TagListDeserializer.java
  139. +1 −1 spring-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/TagMixin.java
  140. +1 −1 ...g-social-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/VideoMixin.java
  141. +1 −1 ...cial-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/VideoPostMixin.java
  142. +1 −1 ...cial-facebook/src/main/java/org/springframework/social/facebook/api/impl/json/WorkEntryMixin.java
  143. +1 −1 ...-facebook/src/main/java/org/springframework/social/facebook/config/annotation/EnableFacebook.java
  144. +11 −4 ...n/java/org/springframework/social/facebook/config/annotation/FacebookProviderConfigRegistrar.java
  145. +10 −3 .../main/java/org/springframework/social/facebook/config/xml/FacebookConfigBeanDefinitionParser.java
  146. +1 −1 ...cebook/src/main/java/org/springframework/social/facebook/config/xml/FacebookNamespaceHandler.java
  147. +1 −1 ...ng-social-facebook/src/main/java/org/springframework/social/facebook/connect/FacebookAdapter.java
  148. +1 −1 ...facebook/src/main/java/org/springframework/social/facebook/connect/FacebookConnectionFactory.java
  149. +1 −1 ...al-facebook/src/main/java/org/springframework/social/facebook/connect/FacebookOAuth2Template.java
  150. +2 −2 ...l-facebook/src/main/java/org/springframework/social/facebook/connect/FacebookServiceProvider.java
  151. +28 −0 ...ook/src/main/java/org/springframework/social/facebook/security/FacebookAuthenticationService.java
  152. +1 −1 ...ocial-facebook/src/test/java/org/springframework/social/facebook/api/AbstractFacebookApiTest.java
  153. +3 −3 ...ng-social-facebook/src/test/java/org/springframework/social/facebook/api/CommentTemplateTest.java
  154. +7 −3 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/ErrorHandlingTest.java
  155. +5 −5 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/EventTemplateTest.java
  156. +52 −20 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/FeedTemplateTest.java
  157. +3 −3 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/FqlTemplateTest.java
  158. +3 −3 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/FriendTemplateTest.java
  159. +5 −5 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/GroupTemplateTest.java
  160. +3 −3 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/LikeTemplateTest.java
  161. +3 −3 ...ebook/src/test/java/org/springframework/social/facebook/api/LikeTemplate_PreOctober2012_Test.java
  162. +3 −3 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/MediaTemplateTest.java
  163. +3 −3 ...-social-facebook/src/test/java/org/springframework/social/facebook/api/OpenGraphTemplateTest.java
  164. +3 −3 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/PageTemplateTest.java
  165. +3 −3 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/PlacesTemplateTest.java
  166. +3 −3 ...g-social-facebook/src/test/java/org/springframework/social/facebook/api/QuestionTemplateTest.java
  167. +3 −3 spring-social-facebook/src/test/java/org/springframework/social/facebook/api/UserTemplateTest.java
  168. +1 −1 ...ocial-facebook/src/test/java/org/springframework/social/facebook/connect/FacebookAdapterTest.java
  169. +23 −2 src/dist/changelog.txt
  170. +30 −23 src/reference/docbook/index.xml
View
@@ -3,7 +3,7 @@ buildscript {
maven { url 'http://repo.springsource.org/plugins-release' }
}
dependencies {
- classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.1.3'
+ classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.2.2'
}
}
@@ -21,13 +21,12 @@ configure(allprojects) {
springSocialVersion = '1.1.0.BUILD-SNAPSHOT'
hamcrestVersion = '1.3'
jacksonVersion = '1.9.9'
- jspApiVersion = '2.1'
- junitVersion = '4.10'
- mockitoVersion = '1.9.0'
+ jspApiVersion = '2.2.1'
+ junitVersion = '4.11'
+ mockitoVersion = '1.9.5'
servletApiVersion = '2.5'
- springSecurityCryptoVersion = '3.1.2.RELEASE'
- springVersion = '3.1.2.RELEASE'
- springTestMvcVersion = "1.0.0.BUILD-SNAPSHOT"
+ springSecurityCryptoVersion = '3.1.3.RELEASE'
+ springVersion = '3.2.1.RELEASE'
}
[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:none']
@@ -97,10 +96,12 @@ configure(subprojects) { subproject ->
project('spring-social-facebook') {
description = 'Facebook API'
dependencies {
- compile "org.springframework.social:spring-social-core:$springSocialVersion"
- compile "org.springframework.social:spring-social-config:$springSocialVersion"
- compile "org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion"
- testCompile "org.springframework:spring-test-mvc:$springTestMvcVersion"
+ compile ("org.springframework.social:spring-social-core:$springSocialVersion")
+ compile ("org.springframework.social:spring-social-config:$springSocialVersion")
+ compile ("org.springframework.social:spring-social-security:$springSocialVersion", optional)
+ compile ("org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion")
+ compile ("javax.servlet:servlet-api:$servletApiVersion", provided)
+ testCompile ("org.springframework:spring-test:$springVersion")
}
}
@@ -113,8 +114,8 @@ project('spring-social-facebook-web') {
compile ("org.springframework.security:spring-security-crypto:$springSecurityCryptoVersion", optional)
compile ("org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion", optional)
compile ("javax.servlet:servlet-api:$servletApiVersion", provided)
- compile ("javax.servlet.jsp:jsp-api:$jspApiVersion", provided)
- testCompile "org.springframework:spring-test-mvc:$springTestMvcVersion"
+ compile ("javax.servlet.jsp:javax.servlet.jsp-api:$jspApiVersion", provided)
+ testCompile ("org.springframework:spring-test:$springVersion")
}
}
@@ -245,7 +246,7 @@ configure(rootProject) {
task wrapper(type: Wrapper) {
description = 'Generates gradlew[.bat] scripts'
- gradleVersion = '1.1'
+ gradleVersion = '1.4'
}
}
View
@@ -1 +1 @@
-version = 1.1.0.BUILD-SNAPSHOT
+version=1.1.0.BUILD-SNAPSHOT
@@ -1,6 +1,6 @@
-#Thu Sep 06 10:40:29 CDT 2012
+#Sat Feb 02 21:49:22 CST 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.1-bin.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.4-bin.zip
View
@@ -1,10 +1,10 @@
apply plugin: 'maven'
-optionalDeps = []
-providedDeps = []
+ext.optionalDeps = []
+ext.providedDeps = []
-optional = { optionalDeps << it }
-provided = { providedDeps << it }
+ext.optional = { optionalDeps << it }
+ext.provided = { providedDeps << it }
install {
repositories.mavenInstaller {
@@ -16,10 +16,10 @@ def customizePom(pom, gradleProject) {
pom.whenConfigured { generatedPom ->
// respect 'optional' and 'provided' dependencies
gradleProject.optionalDeps.each { dep ->
- generatedPom.dependencies.find { it.artifactId == dep.name }?.optional = true
+ generatedPom.dependencies.findAll { it.artifactId == dep.name }*.optional = true
}
gradleProject.providedDeps.each { dep ->
- generatedPom.dependencies.find { it.artifactId == dep.name }?.scope = 'provided'
+ generatedPom.dependencies.findAll { it.artifactId == dep.name }*.scope = 'provided'
}
// eliminate test-scoped dependencies (no need in maven central poms)
View
@@ -16,6 +16,5 @@
rootProject.name = 'spring-social-facebook'
-include 'docs'
include 'spring-social-facebook'
include 'spring-social-facebook-web'
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2013 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.social.facebook.web;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.social.connect.Connection;
+import org.springframework.social.connect.ConnectionFactoryLocator;
+import org.springframework.social.connect.UsersConnectionRepository;
+import org.springframework.social.connect.support.OAuth2ConnectionFactory;
+import org.springframework.social.connect.web.SignInAdapter;
+import org.springframework.social.facebook.api.Facebook;
+import org.springframework.social.oauth2.AccessGrant;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.context.request.NativeWebRequest;
+import org.springframework.web.servlet.View;
+import org.springframework.web.servlet.view.RedirectView;
+
+/**
+ * Sign in controller that uses the signed_request parameter that Facebook gives to Canvas applications to obtain an access token.
+ * If no access token exists in signed_request, this controller will redirect the top-level browser window to Facebook's authorization dialog.
+ * When Facebook redirects back from the authorization dialog, the signed_request parameter should contain an access token.
+ * @author Craig Walls
+ */
+@Controller
+@RequestMapping(value="/canvas")
+public class CanvasSignInController {
+
+ private final static Log logger = LogFactory.getLog(CanvasSignInController.class);
+
+ private final String clientId;
+
+ private final String canvasPage;
+
+ private final ConnectionFactoryLocator connectionFactoryLocator;
+
+ private final UsersConnectionRepository usersConnectionRepository;
+
+ private final SignInAdapter signInAdapter;
+
+ private final SignedRequestDecoder signedRequestDecoder;
+
+ private String postSignInUrl = "/";
+
+ private String scope;
+
+ @Inject
+ public CanvasSignInController(ConnectionFactoryLocator connectionFactoryLocator, UsersConnectionRepository usersConnectionRepository, SignInAdapter signInAdapter, String clientId, String clientSecret, String canvasPage) {
+ this.usersConnectionRepository = usersConnectionRepository;
+ this.signInAdapter = signInAdapter;
+ this.clientId = clientId;
+ this.canvasPage = canvasPage;
+ this.connectionFactoryLocator = connectionFactoryLocator;
+ this.signedRequestDecoder = new SignedRequestDecoder(clientSecret);
+ }
+
+ /**
+ * The URL or path to redirect to after successful canvas authorization.
+ * Defaults to "/".
+ */
+ public void setPostSignInUrl(String postSignInUrl) {
+ this.postSignInUrl = postSignInUrl;
+ }
+
+ /**
+ * The scope to request during authorization.
+ * Defaults to null (no scope will be requested; Facebook will offer their default scope).
+ */
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
+ @RequestMapping(method=RequestMethod.POST)
+ public View signin(Model model, NativeWebRequest request) throws SignedRequestException {
+ String signedRequest = request.getParameter("signed_request");
+ if (signedRequest == null) {
+ logger.info("Expected a signed_request parameter, but none given. Redirecting to the application's Canvas Page: " + canvasPage);
+ return new RedirectView(canvasPage, false);
+ }
+
+ Map<String, ?> decodedSignedRequest = signedRequestDecoder.decodeSignedRequest(signedRequest);
+ String accessToken = (String) decodedSignedRequest.get("oauth_token");
+ if (accessToken == null) {
+ logger.info("No access token in the signed_request parameter. Redirecting to the authorization dialog.");
+ model.addAttribute("clientId", clientId);
+ model.addAttribute("canvasPage", canvasPage);
+ if (scope != null) {
+ model.addAttribute("scope", scope);
+ }
+ return new AuthorizationDialogRedirectView();
+ }
+
+ logger.info("Access token available in signed_request parameter. Creating connection and signing in.");
+ OAuth2ConnectionFactory<Facebook> connectionFactory = (OAuth2ConnectionFactory<Facebook>) connectionFactoryLocator.getConnectionFactory(Facebook.class);
+ AccessGrant accessGrant = new AccessGrant(accessToken);
+ Connection<Facebook> connection = connectionFactory.createConnection(accessGrant);
+ handleSignIn(connection, request);
+ logger.info("Signed in. Redirecting to post-signin page.");
+ return new RedirectView(postSignInUrl, true);
+ }
+
+
+ private void handleSignIn(Connection<Facebook> connection, NativeWebRequest request) {
+ List<String> userIds = usersConnectionRepository.findUserIdsWithConnection(connection);
+ if (userIds.size() == 1) {
+ usersConnectionRepository.createConnectionRepository(userIds.get(0)).updateConnection(connection);
+ signInAdapter.signIn(userIds.get(0), connection, request);
+ } else {
+ // TODO: This should never happen, but need to figure out what to do if it does happen.
+ logger.error("Expected exactly 1 matching user. Got " + userIds.size() + " metching users.");
+ }
+ }
+
+ private static final class AuthorizationDialogRedirectView implements View {
+ public String getContentType() {
+ return "text/html";
+ }
+
+ public void render(Map<String, ?> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
+ String clientId = (String) model.get("clientId");
+ String canvasPage = (String) model.get("canvasPage");
+ String scope = (String) model.get("scope");
+ response.getWriter().write("<script>");
+ response.getWriter().write("top.location.href='https://www.facebook.com/dialog/oauth?client_id=" + clientId + "&redirect_uri=" + canvasPage);
+ if (scope != null) {
+ response.getWriter().write("&scope=" + formEncode(scope));
+ }
+ response.getWriter().write("';");
+ response.getWriter().write("</script>");
+ response.flushBuffer();
+ }
+
+ private String formEncode(String data) {
+ try {
+ return URLEncoder.encode(data, "UTF-8");
+ }
+ catch (UnsupportedEncodingException ex) {
+ // should not happen, UTF-8 is always supported
+ throw new IllegalStateException(ex);
+ }
+ }
+ }
+
+}
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 the original author or authors.
+ * Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
/*
- * Copyright 2011 the original author or authors.
+ * Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,4 +100,4 @@ private static String md5(String in) {
private FacebookCookieParser() {
}
-}
+}
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 the original author or authors.
+ * Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
/*
- * Copyright 2011 the original author or authors.
+ * Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
/*
- * Copyright 2010 the original author or authors.
+ * Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -61,4 +61,4 @@ public Object resolveArgument(MethodParameter parameter, NativeWebRequest reques
return cookieData.get(key);
}
-}
+}
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 the original author or authors.
+ * Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Oops, something went wrong.

0 comments on commit ed50f12

Please sign in to comment.