Permalink
Browse files

Removing SecureSocial 1 files from master

  • Loading branch information...
1 parent 277a336 commit 271b62e56c5be1648535b99867056bb13703f7de @jaliss committed Jun 6, 2012
Showing with 13 additions and 6,527 deletions.
  1. +2 −4 .gitignore
  2. +11 −14 README.textile
  3. +0 −77 app/controllers/securesocial/PasswordChangeController.java
  4. +0 −179 app/controllers/securesocial/PasswordResetController.java
  5. +0 −244 app/controllers/securesocial/SecureSocial.java
  6. +0 −36 app/controllers/securesocial/SecureSocialPublic.java
  7. +0 −135 app/controllers/securesocial/UsernamePasswordController.java
  8. +0 −68 app/notifiers/securesocial/Mails.java
  9. +0 −1 app/play.plugins
  10. +0 −35 app/securesocial/jobs/PendingActivationsJobs.java
  11. +0 −147 app/securesocial/libs/ExtOAuth2.java
  12. +0 −141 app/securesocial/plugin/SecureSocialPlugin.java
  13. +0 −29 app/securesocial/provider/AccessDeniedException.java
  14. +0 −39 app/securesocial/provider/AuthenticationException.java
  15. +0 −28 app/securesocial/provider/AuthenticationMethod.java
  16. +0 −112 app/securesocial/provider/DefaultUserService.java
  17. +0 −129 app/securesocial/provider/IdentityProvider.java
  18. +0 −116 app/securesocial/provider/OAuth1Provider.java
  19. +0 −155 app/securesocial/provider/OAuth2Provider.java
  20. +0 −136 app/securesocial/provider/OpenIDOAuthHybridProvider.java
  21. +0 −119 app/securesocial/provider/OpenIDProvider.java
  22. +0 −69 app/securesocial/provider/ProviderRegistry.java
  23. +0 −35 app/securesocial/provider/ProviderType.java
  24. +0 −90 app/securesocial/provider/SocialUser.java
  25. +0 −33 app/securesocial/provider/UserId.java
  26. +0 −202 app/securesocial/provider/UserService.java
  27. +0 −61 app/securesocial/provider/providers/FacebookProvider.java
  28. +0 −91 app/securesocial/provider/providers/FoursquareProvider.java
  29. +0 −142 app/securesocial/provider/providers/GitHubProvider.java
  30. +0 −154 app/securesocial/provider/providers/GoogleOAuth2Provider.java
  31. +0 −49 app/securesocial/provider/providers/GoogleOpenIDProvider.java
  32. +0 −73 app/securesocial/provider/providers/GoogleProvider.java
  33. +0 −68 app/securesocial/provider/providers/LinkedInProvider.java
  34. +0 −58 app/securesocial/provider/providers/MyOpenIDProvider.java
  35. +0 −56 app/securesocial/provider/providers/TwitterProvider.java
  36. +0 −101 app/securesocial/provider/providers/UsernamePasswordProvider.java
  37. +0 −89 app/securesocial/provider/providers/WordpressProvider.java
  38. +0 −58 app/securesocial/provider/providers/YahooProvider.java
  39. +0 −12 app/securesocial/utils/PasswordHasher.java
  40. +0 −39 app/securesocial/utils/PlayCryptoHasher.java
  41. +0 −27 app/securesocial/utils/SecureSocialPasswordHasher.java
  42. +0 −6 app/views/securesocial/Mails/sendActivationEmail.html
  43. +0 −6 app/views/securesocial/Mails/sendPasswordResetEmail.html
  44. +0 −43 app/views/securesocial/PasswordChangeController/changePassword.html
  45. +0 −35 app/views/securesocial/PasswordResetController/changePassword.html
  46. +0 −41 app/views/securesocial/PasswordResetController/resetPassword.html
  47. +0 −96 app/views/securesocial/SecureSocial/login.html
  48. +0 −30 app/views/securesocial/SecureSocial/main.html
  49. +0 −16 app/views/securesocial/SecureSocial/noticePage.html
  50. +0 −83 app/views/securesocial/UsernamePasswordController/signup.html
  51. +0 −23 app/views/tags/securesocial_password_entry.tag
  52. +0 −49 build.xml
  53. +0 −35 commands.py
  54. +0 −4 conf/dependencies.yml
  55. +0 −75 conf/messages
  56. +0 −42 conf/routes
  57. BIN documentation/images/loginPage.png
  58. BIN documentation/images/signUpPage.png
  59. +0 −291 documentation/manual/home.textile
  60. BIN public/images/providers/facebook.png
  61. BIN public/images/providers/foursquare.png
  62. BIN public/images/providers/github.png
  63. BIN public/images/providers/google.png
  64. BIN public/images/providers/googleoauth2.png
  65. BIN public/images/providers/googleopenid.png
  66. BIN public/images/providers/linkedin.png
  67. BIN public/images/providers/myopenid.png
  68. BIN public/images/providers/twitter.png
  69. BIN public/images/providers/wordpress.png
  70. BIN public/images/providers/yahoo.png
  71. +0 −330 public/stylesheets/bootstrap-1.3.0/bootstrap.min.css
  72. +0 −39 samples-and-tests/deadbolt-integration/app/controllers/Application.java
  73. +0 −71 samples-and-tests/deadbolt-integration/app/controllers/MyDeadboltHandler.java
  74. +0 −36 samples-and-tests/deadbolt-integration/app/models/MyRole.java
  75. +0 −39 samples-and-tests/deadbolt-integration/app/models/MyRoleHolder.java
  76. +0 −39 samples-and-tests/deadbolt-integration/app/views/Application/index.html
  77. +0 −19 samples-and-tests/deadbolt-integration/app/views/Application/onlyTwitterUsers.html
  78. +0 −19 samples-and-tests/deadbolt-integration/app/views/errors/404.html
  79. +0 −21 samples-and-tests/deadbolt-integration/app/views/errors/500.html
  80. +0 −30 samples-and-tests/deadbolt-integration/app/views/main.html
  81. +0 −306 samples-and-tests/deadbolt-integration/conf/application.conf
  82. +0 −5 samples-and-tests/deadbolt-integration/conf/dependencies.yml
  83. +0 −3 samples-and-tests/deadbolt-integration/conf/messages
  84. +0 −17 samples-and-tests/deadbolt-integration/conf/routes
  85. BIN samples-and-tests/deadbolt-integration/public/images/favicon.png
  86. +0 −16 samples-and-tests/deadbolt-integration/public/javascripts/jquery-1.5.2.min.js
  87. +0 −330 samples-and-tests/deadbolt-integration/public/stylesheets/bootstrap.min.css
  88. 0 samples-and-tests/deadbolt-integration/public/stylesheets/main.css
  89. +0 −7 samples-and-tests/deadbolt-integration/test/Application.test.html
  90. +0 −17 samples-and-tests/deadbolt-integration/test/ApplicationTest.java
  91. +0 −13 samples-and-tests/deadbolt-integration/test/BasicTest.java
  92. +0 −7 samples-and-tests/deadbolt-integration/test/data.yml
  93. +0 −12 samples-and-tests/testapp/app/controllers/Application.java
  94. +0 −35 samples-and-tests/testapp/app/views/Application/index.html
  95. +0 −19 samples-and-tests/testapp/app/views/errors/404.html
  96. +0 −21 samples-and-tests/testapp/app/views/errors/500.html
  97. +0 −30 samples-and-tests/testapp/app/views/main.html
  98. +0 −305 samples-and-tests/testapp/conf/application.conf
  99. +0 −4 samples-and-tests/testapp/conf/dependencies.yml
  100. +0 −3 samples-and-tests/testapp/conf/messages
  101. +0 −18 samples-and-tests/testapp/conf/routes
  102. BIN samples-and-tests/testapp/public/images/favicon.png
  103. +0 −16 samples-and-tests/testapp/public/javascripts/jquery-1.5.2.min.js
  104. +0 −330 samples-and-tests/testapp/public/stylesheets/bootstrap-1.3.0/bootstrap.min.css
  105. 0 samples-and-tests/testapp/public/stylesheets/main.css
  106. +0 −7 samples-and-tests/testapp/test/Application.test.html
  107. +0 −17 samples-and-tests/testapp/test/ApplicationTest.java
  108. +0 −13 samples-and-tests/testapp/test/BasicTest.java
  109. +0 −7 samples-and-tests/testapp/test/data.yml
  110. 0 src/play.plugins
View
@@ -4,10 +4,8 @@
*.pyc
# Files related to Play build or usage
-dist
-lib
-samples-and-tests/*/tmp/
-samples-and-tests/*/modules/
+target
+logs
# IDE and editors
*~
View
@@ -1,26 +1,23 @@
-h1. SecureSocial Module for Play! Framework Applications
+h1. SecureSocial Module for Play 2
-SecureSocial allows you to add an authentication UI to your app that works with services based on OAuth1, OAuth2, OpenID and OpenID+OAuth hybrid protocols.
-
-It also provides a Username and Password mechanism for users that do not wish to use existing accounts in other networks.
+SecureSocial allows you to add an authentication UI to your app that works with services based on OAuth1, OAuth2 and OpenID protocols. SecureSocial provides Scala and Java APIs so you can integrate it using your preferred language.
The following services are supported in this release:
* Twitter (OAuth1)
* Facebook (OAuth2)
-* Google (OpenID + OAuth Hybrid)
-* Google (Oauth2)
-* Yahoo (OpenID + OAuth Hybrid)
-* LinkedIn (OAuth1)
-* Foursquare (OAuth2)
-* MyOpenID (OpenID)
-* Wordpress (OpenID)
-* Username and Password
+* Google (OAuth2)
-The module does not depend on any external Java libray. It relies only on what the Play! Framework provides and uses the awesome <a href="http://twitter.github.com/bootstrap/">Bootstrap toolkit from Twitter</a> to style the UI.
+The following are going to be supported shortly:
-There is a live demo at <a href="http://securesocial-jaliss.rhcloud.com/">http://securesocial-jaliss.rhcloud.com</a>. You can try all the providers there except the Username and Password one because the app cannot send emails on that server.
+* Yahoo
+* LinkedIn
+* Foursquare
+* MyOpenID
+* Wordpress
+* Username and Password
+The module does not depend on any external Java libray. It relies only on what the Play! Framework provides and uses the awesome <a href="http://twitter.github.com/bootstrap/">Bootstrap toolkit from Twitter</a> to style the UI.
Source code is available at <a href="https://github.com/jaliss/securesocial">https://github.com/jaliss/securesocial</a>
Written by Jorge Aliss (<a href="http://www.twitter.com/jaliss">@jaliss</a>)
@@ -1,77 +0,0 @@
-package controllers.securesocial;
-
-import play.Logger;
-import play.data.validation.Equals;
-import play.data.validation.Required;
-import play.data.validation.Validation;
-import play.i18n.Messages;
-import play.mvc.Controller;
-import play.mvc.With;
-import securesocial.provider.SocialUser;
-import securesocial.provider.UserService;
-import securesocial.utils.SecureSocialPasswordHasher;
-
-/**
- * User: kink
- * Date: 2012.05.08
- * Time: 22:22
- */
-@With(SecureSocial.class)
-public class PasswordChangeController extends Controller {
-
- protected static final String SECURESOCIAL_ERROR_CHANGING_PASSWORD = "securesocial.changeError";
- protected static final String SECURESOCIAL_CHANGE_CURRENT_PASSWORD_ERROR = "securesocial.changeCurrentPasswordError";
- protected static final String SECURESOCIAL_WRONG_PASSWORD = "securesocial.wrongPassword";
- protected static final String SECURESOCIAL_PASSWORD_CHANGED = "securesocial.changeSuccess";
- protected static final String SECURESOCIAL_PASSWORD_CHANGE_TITLE = "securesocial.changeSuccessTitle";
-
- public static void changePassword() {
- session.getAuthenticityToken();
- render();
- }
-
- public static void doChange(@Required String currentPassword,
- @Required String newPassword,
- @Required @Equals(message = "securesocial.passwordsMustMatch", value = "newPassword") String confirmPassword) {
- checkAuthenticity();
- if (validation.hasErrors()) {
- tryAgain(newPassword, confirmPassword);
- }
-
- SocialUser user = SecureSocial.getCurrentUser();
- if (user == null) {
- // Error, as we should be logged in already, and thus have the user available
- error();
- }
-
- if (!SecureSocialPasswordHasher.verifyPasswordHash(currentPassword, user.password)) {
- flash.error(Messages.get(SECURESOCIAL_CHANGE_CURRENT_PASSWORD_ERROR));
- Validation.addError(SecureSocial.CURRENT_PASSWORD, SECURESOCIAL_WRONG_PASSWORD);
-
- tryAgain(newPassword, confirmPassword);
- }
-
- user.password = SecureSocialPasswordHasher.passwordHash(newPassword);
-
- try {
- UserService.save(user);
- } catch (Throwable e) {
- Logger.error(e, "Error while invoking UserService.save()");
- flash.error(Messages.get(SECURESOCIAL_ERROR_CHANGING_PASSWORD));
- tryAgain(newPassword, confirmPassword);
- }
-
- flash.success(Messages.get(SECURESOCIAL_PASSWORD_CHANGED));
- final String title = Messages.get(SECURESOCIAL_PASSWORD_CHANGE_TITLE);
- render(UsernamePasswordController.SECURESOCIAL_SECURE_SOCIAL_NOTICE_PAGE_HTML, title);
- }
-
- private static void tryAgain(String newPassword, String confirmPassword) {
- flash.put(SecureSocial.NEW_PASSWORD, newPassword);
- flash.put(SecureSocial.CONFIRM_PASSWORD, confirmPassword);
- validation.keep();
- changePassword();
- }
-
-
-}
@@ -1,179 +0,0 @@
-package controllers.securesocial;
-
-import notifiers.securesocial.Mails;
-import play.Logger;
-import play.data.validation.Email;
-import play.data.validation.Equals;
-import play.data.validation.Required;
-import play.i18n.Messages;
-import play.mvc.Controller;
-import securesocial.provider.SocialUser;
-import securesocial.provider.UserService;
-import securesocial.utils.SecureSocialPasswordHasher;
-
-/**
- * Controller for handling the password reset flow, for cases where the user has lost his/her
- * password and needs a way to reset it to a known one
- */
-public class PasswordResetController extends Controller {
-
- private static final String PASSWORD_IS_RESET = "securesocial.resetSuccess";
- private static final String PASSWORD_RESET_TITLE = "securesocial.resetSuccessTitle";
- private static final String RESET_MAIL_SENT = "securesocial.resetEmailSent";
- private static final String RESET_MAIL_SENT_TITLE = "securesocial.resetEmailSentTitle";
-
- private static final String INVALID_RESET_TITLE = "securesocial.invalidResetTitle";
- private static final String INVALID_RESET_LINK = "securesocial.invalidResetLink";
- private static final String SECURESOCIAL_ERROR_PASSWORD_RESET = "securesocial.resetError";
-
-
- public static void resetPassword() {
- session.getAuthenticityToken();
- render();
- }
-
- /**
- * Post endpoint for sending out password reset emails
- *
- * @param email
- */
- public static void sendEmail(@Required @Email(message = "securesocial.invalidEmail") String email) {
- checkAuthenticity();
- if (validation.hasErrors()) {
- tryAgainRequestReset(email);
- }
-
- try {
- // Check that email exists in the database
- SocialUser user = UserService.find(email);
-
- if (user == null) {
- // Show "email sent" page even if the user does not exist, to prevent figuring out emails this way
- showEmailSuccessPage(email);
- }
-
- final String uuid = UserService.createPasswordReset(user);
- Mails.sendPasswordResetEmail(user, uuid);
- showEmailSuccessPage(email);
- } catch (Exception e) {
- Logger.error(e, "Error while invoking " + PasswordResetController.class.getSimpleName() + ".sendEmail");
- flash.error(Messages.get(SECURESOCIAL_ERROR_PASSWORD_RESET));
- tryAgainRequestReset(email);
- }
- }
-
- /**
- * Show a success page for sending out the reset email. This page does double duty as the error page, when
- * a user requests a password reset for an email that we don't know about
- */
- private static void showEmailSuccessPage(final String email) {
- flash.success(Messages.get(RESET_MAIL_SENT, email));
- final String title = Messages.get(RESET_MAIL_SENT_TITLE);
- render(UsernamePasswordController.SECURESOCIAL_SECURE_SOCIAL_NOTICE_PAGE_HTML, title);
- }
-
-
- /**
- * The provided email
- *
- * @param email
- */
- private static void tryAgainRequestReset(String email) {
- flash.put(SecureSocial.EMAIL, email);
- validation.keep();
- resetPassword();
- }
-
-
- /**
- * Controller for rendering the reset my password page
- *
- * @param username
- * @param uuid
- */
- public static void changePassword(String username, String uuid) {
- if (validation.hasErrors()) {
- // Not valid username and uuid -> show error page
- showInvalidLinkFollowedPage();
- }
-
- try {
- SocialUser user = UserService.fetchForPasswordReset(username, uuid);
- if (user == null) {
- showInvalidLinkFollowedPage();
- }
-
- renderArgs.put(SecureSocial.USERNAME, username);
- renderArgs.put(SecureSocial.UUID, uuid);
- render();
- } catch (Exception e) {
- Logger.error(e, "Error while invoking " + PasswordResetController.class.getSimpleName() + ".changePassword");
- flash.error(Messages.get(SECURESOCIAL_ERROR_PASSWORD_RESET));
- showInvalidLinkFollowedPage();
- }
- }
-
- /**
- * Post endpoint for the new password. Requires the username, uuid and authenticity token to be present, in order
- * to allow the password change to continue
- *
- * @param username
- * @param uuid
- * @param newPassword
- * @param confirmPassword
- */
- public static void doChange(@Required String username,
- @Required String uuid,
- @Required String newPassword,
- @Required @Equals(message = "securesocial.passwordsMustMatch", value = "newPassword") String confirmPassword) {
- checkAuthenticity();
- if (validation.hasErrors()) {
- tryAgainChangePassword(username, uuid, newPassword, confirmPassword);
- }
-
- SocialUser user = UserService.fetchForPasswordReset(username, uuid);
- if (user == null) {
- showInvalidLinkFollowedPage();
- }
-
- try {
- user.password = SecureSocialPasswordHasher.passwordHash(newPassword);
- UserService.disableResetCode(username, uuid);
- UserService.save(user);
-
- flash.success(Messages.get(PASSWORD_IS_RESET));
- final String title = Messages.get(PASSWORD_RESET_TITLE);
- render(UsernamePasswordController.SECURESOCIAL_SECURE_SOCIAL_NOTICE_PAGE_HTML, title);
- } catch (Exception e) {
- Logger.error(e, "Error while invoking " + PasswordResetController.class.getSimpleName() + ".doChange");
- flash.error(Messages.get(SECURESOCIAL_ERROR_PASSWORD_RESET));
- tryAgainChangePassword(username, uuid, newPassword, confirmPassword);
- }
- }
-
- /**
- * Show the notification page, with an "invalid link followed"-message
- */
- private static void showInvalidLinkFollowedPage() {
- flash.error(Messages.get(INVALID_RESET_LINK));
- final String title = Messages.get(INVALID_RESET_TITLE);
- render(UsernamePasswordController.SECURESOCIAL_SECURE_SOCIAL_NOTICE_PAGE_HTML, title);
- }
-
- /**
- * Passwords didn't match, so let the user try again
- *
- * @param username
- * @param uuid
- * @param newPassword
- * @param confirmPassword
- */
- private static void tryAgainChangePassword(String username, String uuid, String newPassword, String confirmPassword) {
- flash.put(SecureSocial.NEW_PASSWORD, newPassword);
- flash.put(SecureSocial.CONFIRM_PASSWORD, confirmPassword);
- validation.keep();
- changePassword(username, uuid);
- }
-
-
-}
Oops, something went wrong.

0 comments on commit 271b62e

Please sign in to comment.