stormpath-rails 1.1.2.beta → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rspec +1 -1
  4. data/.rubocop.yml +22 -0
  5. data/.travis.yml +6 -3
  6. data/Gemfile +10 -3
  7. data/README.md +139 -142
  8. data/Rakefile +9 -9
  9. data/app/assets/stylesheets/stormpath.css.scss +3 -2
  10. data/app/controllers/stormpath/rails/base_controller.rb +25 -6
  11. data/app/controllers/stormpath/rails/change_password/create_controller.rb +68 -0
  12. data/app/controllers/stormpath/rails/change_password/new_controller.rb +38 -0
  13. data/app/controllers/stormpath/rails/forgot_password/create_controller.rb +37 -0
  14. data/app/controllers/stormpath/rails/forgot_password/new_controller.rb +14 -0
  15. data/app/controllers/stormpath/rails/login/create_controller.rb +60 -0
  16. data/app/controllers/stormpath/rails/login/new_controller.rb +20 -0
  17. data/app/controllers/stormpath/rails/logout/create_controller.rb +61 -0
  18. data/app/controllers/stormpath/rails/oauth2/create_controller.rb +82 -0
  19. data/app/controllers/stormpath/rails/oauth2/new_controller.rb +11 -0
  20. data/app/controllers/stormpath/rails/profile/show_controller.rb +15 -0
  21. data/app/controllers/stormpath/rails/register/create_controller.rb +86 -0
  22. data/app/controllers/stormpath/rails/register/new_controller.rb +20 -0
  23. data/app/controllers/stormpath/rails/verify_email/create_controller.rb +37 -0
  24. data/app/controllers/stormpath/rails/verify_email/show_controller.rb +51 -0
  25. data/app/forms/stormpath/rails/login_form.rb +60 -0
  26. data/app/forms/stormpath/rails/registration_form.rb +106 -0
  27. data/app/forms/stormpath/rails/registration_form_fields.rb +71 -0
  28. data/app/helpers/social_helper.rb +2 -1
  29. data/app/serializers/stormpath/rails/account_serializer.rb +32 -0
  30. data/app/serializers/stormpath/rails/form_serializer.rb +37 -0
  31. data/app/serializers/stormpath/rails/login_new_serializer.rb +11 -0
  32. data/app/serializers/stormpath/rails/profile_serializer.rb +71 -0
  33. data/app/serializers/stormpath/rails/registration_form_serializer.rb +11 -0
  34. data/app/services/stormpath/rails/account_from_access_token/local_account_resolution.rb +48 -0
  35. data/app/services/stormpath/rails/account_from_access_token/stormpath_account_resolution.rb +27 -0
  36. data/app/services/stormpath/rails/account_from_access_token.rb +33 -0
  37. data/app/services/stormpath/rails/account_login.rb +28 -0
  38. data/app/services/stormpath/rails/account_login_with_stormpath_token.rb +32 -0
  39. data/app/services/stormpath/rails/client_credentials_authentication.rb +40 -0
  40. data/app/services/stormpath/rails/controller_authentication/from_basic_auth.rb +45 -0
  41. data/app/services/stormpath/rails/controller_authentication/from_bearer_auth.rb +34 -0
  42. data/app/services/stormpath/rails/controller_authentication/from_cookies.rb +71 -0
  43. data/app/services/stormpath/rails/controller_authentication.rb +44 -0
  44. data/app/services/stormpath/rails/delete_access_token.rb +48 -0
  45. data/app/services/stormpath/rails/delete_refresh_token.rb +11 -0
  46. data/app/services/stormpath/rails/forgot_password_token_verification.rb +31 -0
  47. data/app/services/stormpath/rails/password_change.rb +17 -0
  48. data/app/services/stormpath/rails/refresh_token_authentication.rb +28 -0
  49. data/app/services/stormpath/rails/resend_email_verification.rb +33 -0
  50. data/app/services/stormpath/rails/send_password_reset_email.rb +33 -0
  51. data/app/services/stormpath/rails/token_cookie_setter.rb +84 -0
  52. data/app/services/stormpath/rails/verify_email_token.rb +27 -0
  53. data/app/views/{passwords/forgot_change.html.erb → stormpath/rails/change_password/new.html.erb} +4 -10
  54. data/app/views/{passwords/forgot.html.erb → stormpath/rails/forgot_password/new.html.erb} +14 -4
  55. data/app/views/{layouts → stormpath/rails/layouts}/stormpath.html.erb +3 -3
  56. data/app/views/stormpath/rails/login/_form.html.erb +45 -0
  57. data/app/views/stormpath/rails/login/new.html.erb +12 -0
  58. data/app/views/stormpath/rails/register/_form.html.erb +19 -0
  59. data/app/views/{users → stormpath/rails/register}/new.html.erb +3 -3
  60. data/app/views/stormpath/rails/shared/_input.html.erb +15 -0
  61. data/app/views/stormpath/rails/verify_email/new.html.erb +49 -0
  62. data/bin/console +3 -3
  63. data/bin/rails +1 -1
  64. data/bin/rake +2 -2
  65. data/bin/rspec +2 -2
  66. data/config/initializers/assets.rb +3 -1
  67. data/lib/generators/stormpath/install/install_generator.rb +1 -92
  68. data/lib/generators/stormpath/install/templates/default_config.yml +229 -0
  69. data/lib/generators/stormpath/views/USAGE +0 -0
  70. data/lib/generators/stormpath/views/views_generator.rb +2 -2
  71. data/lib/stormpath/rails/client.rb +8 -85
  72. data/lib/stormpath/rails/config/account_store_verification.rb +45 -0
  73. data/lib/stormpath/rails/config/application_resolution.rb +76 -0
  74. data/lib/stormpath/rails/config/dynamic_configuration.rb +50 -0
  75. data/lib/stormpath/rails/config/read_file.rb +35 -0
  76. data/lib/stormpath/rails/configuration.rb +30 -35
  77. data/lib/stormpath/rails/content_type_negotiator.rb +50 -0
  78. data/lib/stormpath/rails/controller.rb +36 -5
  79. data/lib/stormpath/rails/errors/invalid_sptoken_error.rb +9 -0
  80. data/lib/stormpath/rails/errors/no_sptoken_error.rb +13 -0
  81. data/lib/stormpath/rails/router.rb +75 -0
  82. data/lib/stormpath/rails/routing_constraint.rb +9 -0
  83. data/lib/stormpath/rails/social.rb +6 -6
  84. data/lib/stormpath/rails/version.rb +2 -1
  85. data/lib/stormpath/rails.rb +9 -19
  86. data/lib/stormpath-rails.rb +1 -0
  87. data/stormpath-rails.gemspec +13 -11
  88. metadata +96 -54
  89. data/app/controllers/stormpath/rails/omniauth_controller.rb +0 -11
  90. data/app/controllers/stormpath/rails/passwords_controller.rb +0 -56
  91. data/app/controllers/stormpath/rails/sessions_controller.rb +0 -52
  92. data/app/controllers/stormpath/rails/users_controller.rb +0 -65
  93. data/app/views/passwords/edit.html.erb +0 -0
  94. data/app/views/passwords/email_sent.html.erb +0 -15
  95. data/app/views/passwords/forgot_change_failed.html.erb +0 -14
  96. data/app/views/passwords/forgot_complete.html.erb +0 -19
  97. data/app/views/sessions/_facebook_login_form.erb +0 -31
  98. data/app/views/sessions/_form.html.erb +0 -31
  99. data/app/views/sessions/_google_login_form.html.erb +0 -3
  100. data/app/views/sessions/_social_auth.html.erb +0 -7
  101. data/app/views/sessions/new.html.erb +0 -21
  102. data/app/views/users/_form.html.erb +0 -43
  103. data/app/views/users/verification_complete.html.erb +0 -20
  104. data/app/views/users/verification_email_sent.html.erb +0 -15
  105. data/app/views/users/verification_failed.html.erb +0 -14
  106. data/app/views/users/verification_resend.html.erb +0 -14
  107. data/config/routes.rb +0 -16
  108. data/lib/generators/stormpath/install/templates/db/migrate/add_stormpath_to_users.rb +0 -21
  109. data/lib/generators/stormpath/install/templates/db/migrate/create_users.rb +0 -12
  110. data/lib/generators/stormpath/install/templates/stormpath.rb +0 -4
  111. data/lib/generators/stormpath/install/templates/user.rb +0 -3
  112. data/lib/generators/stormpath/routes/routes_generator.rb +0 -23
  113. data/lib/generators/stormpath/routes/templates/routes.rb +0 -5
  114. data/lib/stormpath/rails/account.rb +0 -6
  115. data/lib/stormpath/rails/account_status.rb +0 -28
  116. data/lib/stormpath/rails/authentication.rb +0 -72
  117. data/lib/stormpath/rails/authentication_status.rb +0 -22
  118. data/lib/stormpath/rails/session.rb +0 -37
  119. data/lib/stormpath/rails/user.rb +0 -25
  120. data/lib/stormpath/rails/user_config/api_key.rb +0 -17
  121. data/lib/stormpath/rails/user_config/application.rb +0 -12
  122. data/lib/stormpath/rails/user_config/facebook.rb +0 -16
  123. data/lib/stormpath/rails/user_config/forgot_password.rb +0 -12
  124. data/lib/stormpath/rails/user_config/google.rb +0 -16
  125. data/lib/stormpath/rails/user_config/id_site.rb +0 -13
  126. data/lib/stormpath/rails/user_config/login.rb +0 -13
  127. data/lib/stormpath/rails/user_config/logout.rb +0 -13
  128. data/lib/stormpath/rails/user_config/register.rb +0 -13
  129. data/lib/stormpath/rails/user_config/verify_email.rb +0 -14
  130. data/lib/stormpath/testing/helpers.rb +0 -49
@@ -1,56 +1,51 @@
1
1
  module Stormpath
2
2
  module Rails
3
+ InvalidConfiguration = Class.new(ArgumentError)
4
+ DEFAULT_CONFIG_RELATIVE_FILE_PATH =
5
+ '../../../../lib/generators/stormpath/install/templates/default_config.yml'.freeze
6
+
3
7
  class Configuration
4
- attr_accessor :secret_key, :expand_custom_data, :user_model
8
+ attr_reader :user_defined_config_hash
5
9
 
6
- def initialize
7
- @expand_custom_data = true
10
+ def initialize(user_defined_config_hash)
11
+ @user_defined_config_hash = user_defined_config_hash
8
12
  end
9
13
 
10
- def user_model
11
- @user_model ||= ::User
14
+ def application
15
+ config_object.stormpath.application
12
16
  end
13
17
 
14
- [:login, :logout, :register, :id_site, :api_key, :application, :verify_email,
15
- :forgot_password, :facebook, :google].each do |action|
16
- define_method("#{action}=") do |options|
17
- klass = user_config_class(action)
18
- instance_variable_set("@#{action}", klass.new(options))
19
- end
20
-
21
- define_method("#{action}") do |&block|
22
- action_value = instance_variable_get("@#{action}")
23
-
24
- if action_value.nil?
25
- klass = user_config_class(action)
26
- instance_variable_set("@#{action}", klass.new())
27
- end
18
+ def web
19
+ config_object.stormpath.web
20
+ end
28
21
 
29
- if block
30
- block.call(instance_variable_get("@#{action}"))
31
- end
22
+ def config_object
23
+ @config_object ||= RecursiveOpenStruct.new(merged_config_hashes).tap do |config|
24
+ dynamic_config = Config::DynamicConfiguration.new(config)
32
25
 
33
- instance_variable_get("@#{action}")
26
+ config.stormpath.application.href = dynamic_config.app.href
27
+ config.stormpath.web.forgot_password.enabled = dynamic_config.forgot_password_enabled?
28
+ config.stormpath.web.change_password.enabled = dynamic_config.change_password_enabled?
34
29
  end
35
30
  end
36
31
 
37
- private
32
+ def merged_config_hashes
33
+ default_config_hash.deep_merge(user_defined_config_hash)
34
+ end
38
35
 
39
- def user_config_class(action)
40
- UserConfig.const_get(action.to_s.camelize)
36
+ def default_config_hash
37
+ Config::ReadFile.new(
38
+ File.expand_path(DEFAULT_CONFIG_RELATIVE_FILE_PATH, __FILE__)
39
+ ).hash
41
40
  end
42
41
  end
43
42
 
44
- # Return a single instance of Configuration class
45
- # @return [Stormpath::Configuration] single instance
46
43
  def self.config
47
- @configuration ||= Configuration.new
48
- end
49
-
50
- # Configure the settings for this module
51
- # @param [lambda] which will be passed isntance of configuration class
52
- def self.configure
53
- yield(config)
44
+ @configuration ||= Configuration.new(
45
+ Config::ReadFile.new(
46
+ ::Rails.application.root.join('config/stormpath.yml')
47
+ ).hash
48
+ )
54
49
  end
55
50
  end
56
51
  end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+ module Stormpath
3
+ module Rails
4
+ class ContentTypeNegotiator
5
+ attr_accessor :accept_header
6
+
7
+ HTTP_ACCEPT_WILDCARD = '*/*'.freeze
8
+ HTTP_ACCEPT_JSON = 'application/json'.freeze
9
+ HTTP_ACCEPT_HTML = 'text/html'.freeze
10
+
11
+ FULL_NAME_TO_SYMBOL = {
12
+ HTTP_ACCEPT_JSON => :json,
13
+ HTTP_ACCEPT_HTML => :html
14
+ }.freeze
15
+
16
+ def initialize(accept_header)
17
+ accept_header = accept_header.presence || HTTP_ACCEPT_WILDCARD
18
+ @accept_header = normalize(accept_header)
19
+ end
20
+
21
+ def convert
22
+ if accept_header == HTTP_ACCEPT_WILDCARD
23
+ Stormpath::Rails.config.web.produces.first
24
+ elsif accept_header.in?(Stormpath::Rails.config.web.produces)
25
+ accept_header
26
+ end
27
+ end
28
+
29
+ def convert_to_symbol
30
+ FULL_NAME_TO_SYMBOL[convert]
31
+ end
32
+
33
+ def handle_by_stormpath?
34
+ accept_header.in?([HTTP_ACCEPT_WILDCARD] + Stormpath::Rails.config.web.produces)
35
+ end
36
+
37
+ private
38
+
39
+ def normalize(accept_header)
40
+ return accept_header unless accept_header.include?(',')
41
+
42
+ if accept_header.include?(HTTP_ACCEPT_JSON)
43
+ HTTP_ACCEPT_JSON
44
+ elsif accept_header.include?(HTTP_ACCEPT_HTML)
45
+ HTTP_ACCEPT_HTML
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1,13 +1,44 @@
1
- require 'stormpath/rails/authentication'
2
-
3
1
  module Stormpath
4
2
  module Rails
5
3
  module Controller
6
4
  extend ActiveSupport::Concern
7
-
8
- include Stormpath::Rails::Authentication
9
- include Stormpath::Rails::Session
10
5
  include Stormpath::Rails::Social
6
+
7
+ included do
8
+ if respond_to?(:helper_method)
9
+ helper_method :current_account, :signed_in?
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def current_account
16
+ @current_account ||= begin
17
+ ControllerAuthentication.new(cookies, request.headers['Authorization']).authenticate!
18
+ rescue ControllerAuthentication::UnauthenticatedRequest
19
+ nil
20
+ end
21
+ end
22
+
23
+ def signed_in?
24
+ current_account.present?
25
+ end
26
+
27
+ def require_authentication!
28
+ return if signed_in?
29
+ respond_to do |format|
30
+ format.html { redirect_to "#{stormpath_config.web.login.uri}?next=#{request.path}" }
31
+ format.json { render nothing: true, status: 401 }
32
+ end
33
+ end
34
+
35
+ def require_no_authentication!
36
+ redirect_to root_path if signed_in?
37
+ end
38
+
39
+ def stormpath_config
40
+ Stormpath::Rails.config
41
+ end
11
42
  end
12
43
  end
13
44
  end
@@ -0,0 +1,9 @@
1
+ module Stormpath
2
+ module Rails
3
+ class InvalidSptokenError < ArgumentError
4
+ def status
5
+ 404
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ module Stormpath
2
+ module Rails
3
+ class NoSptokenError < ArgumentError
4
+ def message
5
+ 'sptoken parameter not provided.'
6
+ end
7
+
8
+ def status
9
+ 400
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,75 @@
1
+ module Stormpath
2
+ module Rails
3
+ module Router
4
+ STORMPATH_DEFAULT_ACTIONS_MAP = {
5
+ 'register#new' => 'stormpath/rails/register/new#call',
6
+ 'register#create' => 'stormpath/rails/register/create#call',
7
+ 'login#new' => 'stormpath/rails/login/new#call',
8
+ 'login#create' => 'stormpath/rails/login/create#call',
9
+ 'logout#create' => 'stormpath/rails/logout/create#call',
10
+ 'forgot_password#new' => 'stormpath/rails/forgot_password/new#call',
11
+ 'forgot_password#create' => 'stormpath/rails/forgot_password/create#call',
12
+ 'change_password#new' => 'stormpath/rails/change_password/new#call',
13
+ 'change_password#create' => 'stormpath/rails/change_password/create#call',
14
+ 'profile#show' => 'stormpath/rails/profile/show#call',
15
+ 'oauth2#new' => 'stormpath/rails/oauth2/new#call',
16
+ 'oauth2#create' => 'stormpath/rails/oauth2/create#call',
17
+ 'verify_email#show' => 'stormpath/rails/verify_email/show#call',
18
+ 'verify_email#create' => 'stormpath/rails/verify_email/create#call'
19
+ }.freeze
20
+
21
+ def stormpath_rails_routes(actions: {})
22
+ actions = STORMPATH_DEFAULT_ACTIONS_MAP.merge(actions)
23
+
24
+ constraints Stormpath::Rails::RoutingConstraint do
25
+ if Stormpath::Rails.config.web.register.enabled
26
+ get Stormpath::Rails.config.web.register.uri => actions['register#new'], as: :new_register
27
+ post Stormpath::Rails.config.web.register.uri => actions['register#create'], as: :register
28
+ end
29
+
30
+ # LOGIN
31
+ if Stormpath::Rails.config.web.login.enabled
32
+ get Stormpath::Rails.config.web.login.uri => actions['login#new'], as: :new_login
33
+ post Stormpath::Rails.config.web.login.uri => actions['login#create'], as: :login
34
+ end
35
+
36
+ # LOGOUT
37
+ if Stormpath::Rails.config.web.logout.enabled
38
+ post Stormpath::Rails.config.web.logout.uri => actions['logout#create'], as: :logout
39
+ end
40
+
41
+ # FORGOT PASSWORD
42
+ if Stormpath::Rails.config.web.forgot_password.enabled
43
+ get Stormpath::Rails.config.web.forgot_password.uri => actions['forgot_password#new'], as: :new_forgot_password
44
+ post Stormpath::Rails.config.web.forgot_password.uri => actions['forgot_password#create'], as: :forgot_password
45
+ end
46
+
47
+ # CHANGE PASSWORD
48
+ if Stormpath::Rails.config.web.change_password.enabled
49
+ get Stormpath::Rails.config.web.change_password.uri => actions['change_password#new'], as: :new_change_password
50
+ post Stormpath::Rails.config.web.change_password.uri => actions['change_password#create'], as: :change_password
51
+ end
52
+
53
+ # ME
54
+ if Stormpath::Rails.config.web.me.enabled
55
+ get Stormpath::Rails.config.web.me.uri => actions['profile#show']
56
+ end
57
+
58
+ # OAUTH2
59
+ if Stormpath::Rails.config.web.oauth2.enabled
60
+ get Stormpath::Rails.config.web.oauth2.uri => actions['oauth2#new']
61
+ post Stormpath::Rails.config.web.oauth2.uri => actions['oauth2#create']
62
+ end
63
+
64
+ # VERIFY EMAIL
65
+ if Stormpath::Rails.config.web.verify_email.enabled
66
+ get Stormpath::Rails.config.web.verify_email.uri => actions['verify_email#show']
67
+ post Stormpath::Rails.config.web.verify_email.uri => actions['verify_email#create'], as: :verify_email
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+
75
+ ActionDispatch::Routing::Mapper.include(Stormpath::Rails::Router)
@@ -0,0 +1,9 @@
1
+ module Stormpath
2
+ module Rails
3
+ module RoutingConstraint
4
+ def self.matches?(request)
5
+ ContentTypeNegotiator.new(request.headers['HTTP_ACCEPT']).handle_by_stormpath?
6
+ end
7
+ end
8
+ end
9
+ end
@@ -5,25 +5,25 @@ module Stormpath
5
5
 
6
6
  included do
7
7
  helper_method :facebook_login_enabled?, :facebook_app_id,
8
- :google_login_enabled?, :google_client_id, :social_auth?
8
+ :google_login_enabled?, :google_client_id, :social_auth?
9
9
  end
10
-
10
+
11
11
  private
12
12
 
13
13
  def facebook_login_enabled?
14
- configuration.facebook.enabled?
14
+ false # facebook_app_id.present?
15
15
  end
16
16
 
17
17
  def google_login_enabled?
18
- configuration.google.enabled?
18
+ false # google_client_id.present?
19
19
  end
20
20
 
21
21
  def facebook_app_id
22
- configuration.facebook.app_id
22
+ ENV['STORMPATH_FACEBOOK_APP_ID']
23
23
  end
24
24
 
25
25
  def google_client_id
26
- configuration.google.client_id
26
+ ENV['STORMPATH_GOOGLE_CLIENT_ID']
27
27
  end
28
28
 
29
29
  def social_auth?
@@ -1,5 +1,6 @@
1
+ # frozen_string_literal: true
1
2
  module Stormpath
2
3
  module Rails
3
- VERSION = "1.1.2.beta"
4
+ VERSION = '2.0.0'.freeze
4
5
  end
5
6
  end
@@ -1,32 +1,22 @@
1
1
  require 'stormpath-sdk'
2
2
  require 'stormpath/rails/engine'
3
+ require 'stormpath/rails/config/read_file'
4
+ require 'stormpath/rails/config/application_resolution'
5
+ require 'stormpath/rails/config/account_store_verification'
6
+ require 'stormpath/rails/config/dynamic_configuration'
3
7
  require 'stormpath/rails/configuration'
8
+ require 'stormpath/rails/router'
4
9
  require 'virtus'
5
10
 
6
11
  module Stormpath
7
12
  module Rails
8
13
  autoload :Client, 'stormpath/rails/client'
9
- autoload :Authentication, 'stormpath/rails/authentication'
10
- autoload :Session, 'stormpath/rails/session'
11
14
  autoload :Controller, 'stormpath/rails/controller'
12
- autoload :Account, 'stormpath/rails/account'
13
15
  autoload :Version, 'stormpath/rails/version'
14
- autoload :User, 'stormpath/rails/user'
15
- autoload :AuthenticationStatus, 'stormpath/rails/authentication_status'
16
- autoload :AccountStatus, 'stormpath/rails/account_status'
17
16
  autoload :Social, 'stormpath/rails/social'
18
-
19
- module UserConfig
20
- autoload :ApiKey, 'stormpath/rails/user_config/api_key'
21
- autoload :Application, 'stormpath/rails/user_config/application'
22
- autoload :ForgotPassword, 'stormpath/rails/user_config/forgot_password'
23
- autoload :IdSite, 'stormpath/rails/user_config/id_site'
24
- autoload :VerifyEmail, 'stormpath/rails/user_config/verify_email'
25
- autoload :Facebook, 'stormpath/rails/user_config/facebook'
26
- autoload :Google, 'stormpath/rails/user_config/google'
27
- autoload :Login, 'stormpath/rails/user_config/login'
28
- autoload :Logout, 'stormpath/rails/user_config/logout'
29
- autoload :Register, 'stormpath/rails/user_config/register'
30
- end
17
+ autoload :ContentTypeNegotiator, 'stormpath/rails/content_type_negotiator'
18
+ autoload :RoutingConstraint, 'stormpath/rails/routing_constraint'
19
+ autoload :InvalidSptokenError, 'stormpath/rails/errors/invalid_sptoken_error'
20
+ autoload :NoSptokenError, 'stormpath/rails/errors/no_sptoken_error'
31
21
  end
32
22
  end
@@ -1,4 +1,5 @@
1
1
  require 'stormpath/rails'
2
+ require 'recursive-open-struct'
2
3
 
3
4
  module Stormpath
4
5
  module Rails
@@ -4,27 +4,29 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'stormpath/rails/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "stormpath-rails"
7
+ spec.name = 'stormpath-rails'
8
8
  spec.version = Stormpath::Rails::VERSION
9
- spec.authors = ["Nenad Nikolic"]
10
- spec.email = ["nenad.nikolic@infinum.hr"]
9
+ spec.authors = ['Nenad Nikolic']
10
+ spec.email = ['nenad.nikolic@infinum.hr']
11
11
 
12
- spec.summary = %q{TODO: Write a short summary, because Rubygems requires one.}
13
- spec.description = %q{TODO: Write a longer description or delete this line.}
12
+ spec.summary = 'TODO: Write a short summary, because Rubygems requires one.'
13
+ spec.description = 'TODO: Write a longer description or delete this line.'
14
14
  spec.homepage = "TODO: Put your gem's website or public repo URL here."
15
15
 
16
- spec.summary = %q{Stormpath Rails integration}
17
- spec.description = %q{Stormpath Rails integration}
16
+ spec.summary = 'Stormpath Rails integration'
17
+ spec.description = 'Stormpath Rails integration'
18
18
  spec.homepage = 'http://www.stormpath.com'
19
19
 
20
20
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
- spec.bindir = "exe"
21
+ spec.bindir = 'exe'
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
- spec.require_paths = ["lib"]
23
+ spec.require_paths = ['lib']
24
24
 
25
- spec.add_dependency 'stormpath-sdk', '>= 1.0.0.beta.8'
25
+ spec.add_dependency 'stormpath-sdk', '>= 1.1.5'
26
26
  spec.add_dependency 'virtus'
27
27
  spec.add_dependency 'rails', '>= 3.1'
28
+ spec.add_dependency 'recursive-open-struct'
28
29
 
29
- spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency 'rake', '~> 10.0'
31
+ spec.add_development_dependency 'rubocop'
30
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stormpath-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2.beta
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nenad Nikolic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-14 00:00:00.000000000 Z
11
+ date: 2016-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stormpath-sdk
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0.beta.8
19
+ version: 1.1.5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.0.beta.8
26
+ version: 1.1.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: virtus
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: recursive-open-struct
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,20 @@ dependencies:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  description: Stormpath Rails integration
70
98
  email:
71
99
  - nenad.nikolic@infinum.hr
@@ -75,76 +103,91 @@ extra_rdoc_files: []
75
103
  files:
76
104
  - ".gitignore"
77
105
  - ".rspec"
106
+ - ".rubocop.yml"
78
107
  - ".travis.yml"
79
108
  - Gemfile
80
109
  - README.md
81
110
  - Rakefile
82
111
  - app/assets/stylesheets/stormpath.css.scss
83
112
  - app/controllers/stormpath/rails/base_controller.rb
84
- - app/controllers/stormpath/rails/omniauth_controller.rb
85
- - app/controllers/stormpath/rails/passwords_controller.rb
86
- - app/controllers/stormpath/rails/sessions_controller.rb
87
- - app/controllers/stormpath/rails/users_controller.rb
113
+ - app/controllers/stormpath/rails/change_password/create_controller.rb
114
+ - app/controllers/stormpath/rails/change_password/new_controller.rb
115
+ - app/controllers/stormpath/rails/forgot_password/create_controller.rb
116
+ - app/controllers/stormpath/rails/forgot_password/new_controller.rb
117
+ - app/controllers/stormpath/rails/login/create_controller.rb
118
+ - app/controllers/stormpath/rails/login/new_controller.rb
119
+ - app/controllers/stormpath/rails/logout/create_controller.rb
120
+ - app/controllers/stormpath/rails/oauth2/create_controller.rb
121
+ - app/controllers/stormpath/rails/oauth2/new_controller.rb
122
+ - app/controllers/stormpath/rails/profile/show_controller.rb
123
+ - app/controllers/stormpath/rails/register/create_controller.rb
124
+ - app/controllers/stormpath/rails/register/new_controller.rb
125
+ - app/controllers/stormpath/rails/verify_email/create_controller.rb
126
+ - app/controllers/stormpath/rails/verify_email/show_controller.rb
127
+ - app/forms/stormpath/rails/login_form.rb
128
+ - app/forms/stormpath/rails/registration_form.rb
129
+ - app/forms/stormpath/rails/registration_form_fields.rb
88
130
  - app/helpers/social_helper.rb
89
- - app/views/layouts/stormpath.html.erb
90
- - app/views/passwords/edit.html.erb
91
- - app/views/passwords/email_sent.html.erb
92
- - app/views/passwords/forgot.html.erb
93
- - app/views/passwords/forgot_change.html.erb
94
- - app/views/passwords/forgot_change_failed.html.erb
95
- - app/views/passwords/forgot_complete.html.erb
96
- - app/views/sessions/_facebook_login_form.erb
97
- - app/views/sessions/_form.html.erb
98
- - app/views/sessions/_google_login_form.html.erb
99
- - app/views/sessions/_social_auth.html.erb
100
- - app/views/sessions/new.html.erb
101
- - app/views/users/_form.html.erb
102
- - app/views/users/new.html.erb
103
- - app/views/users/verification_complete.html.erb
104
- - app/views/users/verification_email_sent.html.erb
105
- - app/views/users/verification_failed.html.erb
106
- - app/views/users/verification_resend.html.erb
131
+ - app/serializers/stormpath/rails/account_serializer.rb
132
+ - app/serializers/stormpath/rails/form_serializer.rb
133
+ - app/serializers/stormpath/rails/login_new_serializer.rb
134
+ - app/serializers/stormpath/rails/profile_serializer.rb
135
+ - app/serializers/stormpath/rails/registration_form_serializer.rb
136
+ - app/services/stormpath/rails/account_from_access_token.rb
137
+ - app/services/stormpath/rails/account_from_access_token/local_account_resolution.rb
138
+ - app/services/stormpath/rails/account_from_access_token/stormpath_account_resolution.rb
139
+ - app/services/stormpath/rails/account_login.rb
140
+ - app/services/stormpath/rails/account_login_with_stormpath_token.rb
141
+ - app/services/stormpath/rails/client_credentials_authentication.rb
142
+ - app/services/stormpath/rails/controller_authentication.rb
143
+ - app/services/stormpath/rails/controller_authentication/from_basic_auth.rb
144
+ - app/services/stormpath/rails/controller_authentication/from_bearer_auth.rb
145
+ - app/services/stormpath/rails/controller_authentication/from_cookies.rb
146
+ - app/services/stormpath/rails/delete_access_token.rb
147
+ - app/services/stormpath/rails/delete_refresh_token.rb
148
+ - app/services/stormpath/rails/forgot_password_token_verification.rb
149
+ - app/services/stormpath/rails/password_change.rb
150
+ - app/services/stormpath/rails/refresh_token_authentication.rb
151
+ - app/services/stormpath/rails/resend_email_verification.rb
152
+ - app/services/stormpath/rails/send_password_reset_email.rb
153
+ - app/services/stormpath/rails/token_cookie_setter.rb
154
+ - app/services/stormpath/rails/verify_email_token.rb
155
+ - app/views/stormpath/rails/change_password/new.html.erb
156
+ - app/views/stormpath/rails/forgot_password/new.html.erb
157
+ - app/views/stormpath/rails/layouts/stormpath.html.erb
158
+ - app/views/stormpath/rails/login/_form.html.erb
159
+ - app/views/stormpath/rails/login/new.html.erb
160
+ - app/views/stormpath/rails/register/_form.html.erb
161
+ - app/views/stormpath/rails/register/new.html.erb
162
+ - app/views/stormpath/rails/shared/_input.html.erb
163
+ - app/views/stormpath/rails/verify_email/new.html.erb
107
164
  - bin/console
108
165
  - bin/rails
109
166
  - bin/rake
110
167
  - bin/rspec
111
168
  - bin/setup
112
169
  - config/initializers/assets.rb
113
- - config/routes.rb
114
170
  - lib/generators/stormpath/install/install_generator.rb
115
- - lib/generators/stormpath/install/templates/db/migrate/add_stormpath_to_users.rb
116
- - lib/generators/stormpath/install/templates/db/migrate/create_users.rb
117
- - lib/generators/stormpath/install/templates/stormpath.rb
118
- - lib/generators/stormpath/install/templates/user.rb
119
- - lib/generators/stormpath/routes/routes_generator.rb
120
- - lib/generators/stormpath/routes/templates/routes.rb
171
+ - lib/generators/stormpath/install/templates/default_config.yml
121
172
  - lib/generators/stormpath/views/USAGE
122
173
  - lib/generators/stormpath/views/views_generator.rb
123
174
  - lib/stormpath-rails.rb
124
175
  - lib/stormpath/rails.rb
125
- - lib/stormpath/rails/account.rb
126
- - lib/stormpath/rails/account_status.rb
127
- - lib/stormpath/rails/authentication.rb
128
- - lib/stormpath/rails/authentication_status.rb
129
176
  - lib/stormpath/rails/client.rb
177
+ - lib/stormpath/rails/config/account_store_verification.rb
178
+ - lib/stormpath/rails/config/application_resolution.rb
179
+ - lib/stormpath/rails/config/dynamic_configuration.rb
180
+ - lib/stormpath/rails/config/read_file.rb
130
181
  - lib/stormpath/rails/configuration.rb
182
+ - lib/stormpath/rails/content_type_negotiator.rb
131
183
  - lib/stormpath/rails/controller.rb
132
184
  - lib/stormpath/rails/engine.rb
133
- - lib/stormpath/rails/session.rb
185
+ - lib/stormpath/rails/errors/invalid_sptoken_error.rb
186
+ - lib/stormpath/rails/errors/no_sptoken_error.rb
187
+ - lib/stormpath/rails/router.rb
188
+ - lib/stormpath/rails/routing_constraint.rb
134
189
  - lib/stormpath/rails/social.rb
135
- - lib/stormpath/rails/user.rb
136
- - lib/stormpath/rails/user_config/api_key.rb
137
- - lib/stormpath/rails/user_config/application.rb
138
- - lib/stormpath/rails/user_config/facebook.rb
139
- - lib/stormpath/rails/user_config/forgot_password.rb
140
- - lib/stormpath/rails/user_config/google.rb
141
- - lib/stormpath/rails/user_config/id_site.rb
142
- - lib/stormpath/rails/user_config/login.rb
143
- - lib/stormpath/rails/user_config/logout.rb
144
- - lib/stormpath/rails/user_config/register.rb
145
- - lib/stormpath/rails/user_config/verify_email.rb
146
190
  - lib/stormpath/rails/version.rb
147
- - lib/stormpath/testing/helpers.rb
148
191
  - stormpath-rails.gemspec
149
192
  homepage: http://www.stormpath.com
150
193
  licenses: []
@@ -160,14 +203,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
203
  version: '0'
161
204
  required_rubygems_version: !ruby/object:Gem::Requirement
162
205
  requirements:
163
- - - ">"
206
+ - - ">="
164
207
  - !ruby/object:Gem::Version
165
- version: 1.3.1
208
+ version: '0'
166
209
  requirements: []
167
210
  rubyforge_project:
168
- rubygems_version: 2.4.6
211
+ rubygems_version: 2.5.1
169
212
  signing_key:
170
213
  specification_version: 4
171
214
  summary: Stormpath Rails integration
172
215
  test_files: []
173
- has_rdoc: