stormpath-sdk 1.1.5 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -0
  3. data/.ruby-gemset +0 -0
  4. data/.travis.yml +1 -0
  5. data/CHANGES.md +20 -0
  6. data/Gemfile +0 -0
  7. data/README.md +78 -2
  8. data/Rakefile +0 -0
  9. data/lib/stormpath-sdk/api_key.rb +0 -0
  10. data/lib/stormpath-sdk/auth/authentication_result.rb +0 -0
  11. data/lib/stormpath-sdk/auth/basic_authenticator.rb +0 -0
  12. data/lib/stormpath-sdk/auth/basic_login_attempt.rb +0 -0
  13. data/lib/stormpath-sdk/auth/http_basic_authentication.rb +47 -0
  14. data/lib/stormpath-sdk/auth/http_bearer_authentication.rb +27 -0
  15. data/lib/stormpath-sdk/auth/username_password_request.rb +0 -0
  16. data/lib/stormpath-sdk/cache/cache.rb +0 -0
  17. data/lib/stormpath-sdk/cache/cache_entry.rb +0 -0
  18. data/lib/stormpath-sdk/cache/cache_manager.rb +0 -0
  19. data/lib/stormpath-sdk/cache/cache_stats.rb +0 -0
  20. data/lib/stormpath-sdk/cache/disabled_cache_store.rb +0 -0
  21. data/lib/stormpath-sdk/cache/memcached_store.rb +37 -0
  22. data/lib/stormpath-sdk/cache/memory_store.rb +0 -0
  23. data/lib/stormpath-sdk/cache/redis_store.rb +0 -0
  24. data/lib/stormpath-sdk/client.rb +0 -0
  25. data/lib/stormpath-sdk/data_store.rb +1 -0
  26. data/lib/stormpath-sdk/error.rb +5 -5
  27. data/lib/stormpath-sdk/http/authc/sauthc1_signer.rb +0 -0
  28. data/lib/stormpath-sdk/http/http_client_request_executor.rb +2 -3
  29. data/lib/stormpath-sdk/http/request.rb +12 -10
  30. data/lib/stormpath-sdk/http/response.rb +0 -0
  31. data/lib/stormpath-sdk/http/utils.rb +8 -5
  32. data/lib/stormpath-sdk/id_site/id_site_result.rb +0 -0
  33. data/lib/stormpath-sdk/oauth/access_token_authentication_result.rb +0 -0
  34. data/lib/stormpath-sdk/oauth/authenticator.rb +2 -1
  35. data/lib/stormpath-sdk/oauth/error.rb +12 -8
  36. data/lib/stormpath-sdk/oauth/id_site_grant_request.rb +0 -0
  37. data/lib/stormpath-sdk/oauth/local_access_token_verification.rb +45 -0
  38. data/lib/stormpath-sdk/oauth/password_grant.rb +9 -7
  39. data/lib/stormpath-sdk/oauth/password_grant_request.rb +3 -2
  40. data/lib/stormpath-sdk/oauth/refresh_grant_request.rb +0 -0
  41. data/lib/stormpath-sdk/oauth/remote_access_token_verification.rb +28 -0
  42. data/lib/stormpath-sdk/oauth/social_grant.rb +27 -0
  43. data/lib/stormpath-sdk/oauth/social_grant_request.rb +14 -0
  44. data/lib/stormpath-sdk/oauth/stormpath_grant_request.rb +3 -2
  45. data/lib/stormpath-sdk/oauth/verify_access_token.rb +11 -6
  46. data/lib/stormpath-sdk/oauth/{verify_token.rb → verify_token_result.rb} +1 -1
  47. data/lib/stormpath-sdk/provider/account_access.rb +0 -0
  48. data/lib/stormpath-sdk/provider/account_request.rb +0 -0
  49. data/lib/stormpath-sdk/provider/account_resolver.rb +0 -0
  50. data/lib/stormpath-sdk/provider/account_result.rb +0 -0
  51. data/lib/stormpath-sdk/provider/facebook/facebook_provider.rb +0 -0
  52. data/lib/stormpath-sdk/provider/facebook/facebook_provider_data.rb +0 -0
  53. data/lib/stormpath-sdk/provider/github/github_provider.rb +0 -0
  54. data/lib/stormpath-sdk/provider/github/github_provider_data.rb +0 -0
  55. data/lib/stormpath-sdk/provider/google/google_provider.rb +0 -0
  56. data/lib/stormpath-sdk/provider/google/google_provider_data.rb +0 -1
  57. data/lib/stormpath-sdk/provider/linkedin/linkedin_provider.rb +0 -0
  58. data/lib/stormpath-sdk/provider/linkedin/linkedin_provider_data.rb +0 -0
  59. data/lib/stormpath-sdk/provider/provider.rb +0 -0
  60. data/lib/stormpath-sdk/provider/provider_data.rb +0 -0
  61. data/lib/stormpath-sdk/provider/saml/saml_mapping_rules.rb +0 -0
  62. data/lib/stormpath-sdk/provider/saml/saml_provider.rb +0 -0
  63. data/lib/stormpath-sdk/provider/saml/saml_provider_data.rb +0 -0
  64. data/lib/stormpath-sdk/provider/saml/saml_provider_metadata.rb +0 -0
  65. data/lib/stormpath-sdk/provider/stormpath/stormpath_provider.rb +0 -0
  66. data/lib/stormpath-sdk/provider/stormpath/stormpath_provider_data.rb +0 -0
  67. data/lib/stormpath-sdk/resource/access_token.rb +0 -0
  68. data/lib/stormpath-sdk/resource/account_creation_policy.rb +3 -1
  69. data/lib/stormpath-sdk/resource/account_membership.rb +0 -0
  70. data/lib/stormpath-sdk/resource/account_overrides.rb +0 -0
  71. data/lib/stormpath-sdk/resource/account_store.rb +7 -8
  72. data/lib/stormpath-sdk/resource/account_store_mapping.rb +0 -0
  73. data/lib/stormpath-sdk/resource/application.rb +5 -5
  74. data/lib/stormpath-sdk/resource/base.rb +0 -0
  75. data/lib/stormpath-sdk/resource/collection.rb +0 -0
  76. data/lib/stormpath-sdk/resource/custom_data.rb +0 -0
  77. data/lib/stormpath-sdk/resource/custom_data_hash_methods.rb +0 -0
  78. data/lib/stormpath-sdk/resource/custom_data_storage.rb +0 -0
  79. data/lib/stormpath-sdk/resource/directory.rb +1 -0
  80. data/lib/stormpath-sdk/resource/email_template.rb +0 -0
  81. data/lib/stormpath-sdk/resource/email_verification_token.rb +0 -0
  82. data/lib/stormpath-sdk/resource/error.rb +2 -3
  83. data/lib/stormpath-sdk/resource/expansion.rb +0 -0
  84. data/lib/stormpath-sdk/resource/group.rb +0 -0
  85. data/lib/stormpath-sdk/resource/group_membership.rb +0 -0
  86. data/lib/stormpath-sdk/resource/instance.rb +0 -0
  87. data/lib/stormpath-sdk/resource/oauth_policy.rb +0 -0
  88. data/lib/stormpath-sdk/resource/organization.rb +1 -1
  89. data/lib/stormpath-sdk/resource/organization_account_store_mapping.rb +0 -0
  90. data/lib/stormpath-sdk/resource/password_policy.rb +0 -0
  91. data/lib/stormpath-sdk/resource/password_reset_token.rb +0 -0
  92. data/lib/stormpath-sdk/resource/password_strength.rb +0 -0
  93. data/lib/stormpath-sdk/resource/refresh_token.rb +0 -0
  94. data/lib/stormpath-sdk/resource/tenant.rb +0 -0
  95. data/lib/stormpath-sdk/resource/utils.rb +0 -0
  96. data/lib/stormpath-sdk/resource/verification_email.rb +0 -0
  97. data/lib/stormpath-sdk/util/assert.rb +0 -0
  98. data/lib/stormpath-sdk/util/uri_builder.rb +38 -0
  99. data/lib/stormpath-sdk/version.rb +2 -2
  100. data/lib/stormpath-sdk.rb +47 -39
  101. data/spec/api_key_spec.rb +0 -0
  102. data/spec/auth/basic_authenticator_spec.rb +0 -0
  103. data/spec/auth/http_basic_authentication_spec.rb +86 -0
  104. data/spec/auth/http_bearer_authentication_spec.rb +86 -0
  105. data/spec/auth/sauthc1_signer_spec.rb +0 -0
  106. data/spec/cache/cache_entry_spec.rb +0 -0
  107. data/spec/cache/cache_spec.rb +0 -0
  108. data/spec/cache/cache_stats_spec.rb +0 -0
  109. data/spec/client_spec.rb +0 -0
  110. data/spec/data_store_spec.rb +40 -16
  111. data/spec/fixtures/response/create_saml_directory.json +0 -0
  112. data/spec/fixtures/response/create_saml_directory_mapping_rules.json +0 -0
  113. data/spec/fixtures/response/get_saml_directory_provider.json +0 -0
  114. data/spec/fixtures/response/get_saml_directory_provider_metadata.json +0 -0
  115. data/spec/oauth/access_token_authentication_result_spec.rb +8 -0
  116. data/spec/provider/account_resolver_spec.rb +0 -0
  117. data/spec/provider/provider_spec.rb +0 -0
  118. data/spec/resource/account_creation_policy_spec.rb +125 -2
  119. data/spec/resource/account_store_mapping_spec.rb +0 -0
  120. data/spec/resource/account_store_spec.rb +40 -13
  121. data/spec/resource/application_spec.rb +268 -51
  122. data/spec/resource/base_spec.rb +0 -0
  123. data/spec/resource/collection_spec.rb +60 -2
  124. data/spec/resource/custom_data_spec.rb +0 -0
  125. data/spec/resource/directory_spec.rb +82 -1
  126. data/spec/resource/email_template_spec.rb +0 -0
  127. data/spec/resource/expansion_spec.rb +0 -0
  128. data/spec/resource/group_membership_spec.rb +0 -0
  129. data/spec/resource/group_spec.rb +0 -0
  130. data/spec/resource/organization_spec.rb +37 -8
  131. data/spec/resource/password_policy_spec.rb +0 -0
  132. data/spec/resource/password_strength_spec.rb +0 -0
  133. data/spec/resource/status_spec.rb +0 -0
  134. data/spec/resource/tenant_spec.rb +0 -0
  135. data/spec/spec_helper.rb +5 -6
  136. data/spec/support/custom_data_storage_behavior.rb +0 -0
  137. data/spec/support/mocked_provider_accounts.rb +129 -117
  138. data/spec/support/resource_factory.rb +0 -0
  139. data/spec/support/resource_matchers.rb +7 -0
  140. data/spec/support/test_cache_stores.rb +0 -0
  141. data/spec/support/test_request_executor.rb +0 -0
  142. data/spec/util/uri_builder_spec.rb +47 -0
  143. data/stormpath-sdk.gemspec +1 -0
  144. data/support/api.rb +0 -0
  145. metadata +29 -4
data/spec/spec_helper.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  # issued before any of your application code is required!
4
4
  require 'simplecov'
5
5
  SimpleCov.start do
6
- add_filter {|src| src.filename =~ /spec/ }
6
+ add_filter { |src| src.filename =~ /spec/ }
7
7
  end
8
8
 
9
9
  require 'stormpath-sdk'
@@ -76,7 +76,7 @@ module Stormpath
76
76
  end
77
77
 
78
78
  def test_missing_env_vars
79
- TEST_ENV_REQUIRED_VARS.reject do |var, message|
79
+ TEST_ENV_REQUIRED_VARS.reject do |var, _message|
80
80
  ENV[var.to_s]
81
81
  end
82
82
  end
@@ -93,7 +93,6 @@ module Stormpath
93
93
  test_api_client.directories.get test_directory_with_verification_url
94
94
  end
95
95
 
96
-
97
96
  def fixture_path
98
97
  File.expand_path('../fixtures/response', __FILE__)
99
98
  end
@@ -104,7 +103,7 @@ module Stormpath
104
103
  end
105
104
 
106
105
  module TestResourceHelpers
107
- def build_account(opts={})
106
+ def build_account(opts = {})
108
107
  opts.tap do |o|
109
108
  o[:surname] = (!opts[:surname].blank? && opts[:surname]) || 'surname'
110
109
  o[:given_name] = (!opts[:given_name].blank? && opts[:given_name]) || 'givenname'
@@ -119,12 +118,12 @@ module Stormpath
119
118
  include UUIDTools
120
119
 
121
120
  %w(application directory organization group user).each do |resource|
122
- define_method "random_#{resource}_name" do |suffix=nil|
121
+ define_method "random_#{resource}_name" do |suffix = nil|
123
122
  "#{random_string}_#{resource}_#{suffix}"
124
123
  end
125
124
  end
126
125
 
127
- def random_name_key(suffix='test')
126
+ def random_name_key(suffix = 'test')
128
127
  "#{random_string}-namekey-#{suffix}"
129
128
  end
130
129
 
File without changes
@@ -1,132 +1,144 @@
1
1
  module Stormpath
2
2
  module Test
3
- def self.mocked_account(provider)
4
- if provider.to_sym == :google
5
- MultiJson.dump(GOOGLE_ACCOUNT)
6
- elsif provider.to_sym == :facebook
7
- MultiJson.dump(FACEBOOK_ACCOUNT)
8
- elsif provider.to_sym == :linkedin
9
- MultiJson.dump(LINKEDIN_ACCOUNT)
10
- elsif provider.to_sym == :github
11
- MultiJson.dump(GITHUB_ACCOUNT)
12
- end
3
+ def self.mocked_account(provider)
4
+ if provider.to_sym == :google
5
+ MultiJson.dump(GOOGLE_ACCOUNT)
6
+ elsif provider.to_sym == :facebook
7
+ MultiJson.dump(FACEBOOK_ACCOUNT)
8
+ elsif provider.to_sym == :linkedin
9
+ MultiJson.dump(LINKEDIN_ACCOUNT)
10
+ elsif provider.to_sym == :github
11
+ MultiJson.dump(GITHUB_ACCOUNT)
13
12
  end
13
+ end
14
14
 
15
- def self.mocked_provider_data(provider)
16
- if provider.to_sym == :google
17
- MultiJson.dump(GOOGLE_PROVIDER_DATA)
18
- elsif provider.to_sym == :facebook
19
- MultiJson.dump(FACEBOOK_PROVIDER_DATA)
20
- elsif provider.to_sym == :linkedin
21
- MultiJson.dump(LINKEDIN_PROVIDER_DATA)
22
- elsif provider.to_sym == :github
23
- MultiJson.dump(GITHUB_PROVIDER_DATA)
24
- end
15
+ def self.mocked_provider_data(provider)
16
+ if provider.to_sym == :google
17
+ MultiJson.dump(GOOGLE_PROVIDER_DATA)
18
+ elsif provider.to_sym == :facebook
19
+ MultiJson.dump(FACEBOOK_PROVIDER_DATA)
20
+ elsif provider.to_sym == :linkedin
21
+ MultiJson.dump(LINKEDIN_PROVIDER_DATA)
22
+ elsif provider.to_sym == :github
23
+ MultiJson.dump(GITHUB_PROVIDER_DATA)
25
24
  end
25
+ end
26
26
 
27
- FACEBOOK_ACCOUNT = {
28
- href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7",
29
- username: "damir.svrtan",
30
- email: "hladnidamir@hotmail.com",
31
- givenName: "Damir",
32
- middleName: nil,
33
- surname: "Svrtan",
34
- fullName: "Damir Svrtan",
35
- status: "ENABLED",
36
- emailVerificationToken: nil,
37
- customData: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/customData"},
38
- providerData: { href:"https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/providerData"},
39
- directory: { href: "https://api.stormpath.com/v1/directories/7ibyn2idP1d9p3qJOomeNP"},
40
- tenant: { href: "https://api.stormpath.com/v1/tenants/60bD3bKLej6JoFhyKFHiOk"},
41
- groups: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/groups"},
42
- groupMemberships: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/groupMemberships"}
43
- }
27
+ def self.mocked_social_grant_response
28
+ MultiJson.dump(STORMPATH_GRANT_RESPONSE)
29
+ end
44
30
 
45
- FACEBOOK_PROVIDER_DATA = {
46
- href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/providerData",
47
- createdAt: "2014-05-19T13:32:16.884Z",
48
- modifiedAt: "2014-05-19T13:32:16.927Z",
49
- accessToken: "CAATmZBgxF6rMBAPYbfBhGrVPRw27nn9fAz6bR0DBV1XGfOcSYXSBrhZCkE1y1lWue348fboRxqX7nz88KBYi05qCHw4AQoZCqyIaWedEXrV2vFVzVHo2glq6Vb1ofAWcEHva7baZAaojA8KN5DVz4UTToKgvoIMa1kjyvZCmFZBpYXoG7H3aIKoyWJzUGCDIUrcFjvjnNZBvAZDZD",
50
- providerId: "facebook"
51
- }
31
+ FACEBOOK_ACCOUNT = {
32
+ href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7",
33
+ username: "damir.svrtan",
34
+ email: "hladnidamir@hotmail.com",
35
+ givenName: "Damir",
36
+ middleName: nil,
37
+ surname: "Svrtan",
38
+ fullName: "Damir Svrtan",
39
+ status: "ENABLED",
40
+ emailVerificationToken: nil,
41
+ customData: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/customData"},
42
+ providerData: { href:"https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/providerData"},
43
+ directory: { href: "https://api.stormpath.com/v1/directories/7ibyn2idP1d9p3qJOomeNP"},
44
+ tenant: { href: "https://api.stormpath.com/v1/tenants/60bD3bKLej6JoFhyKFHiOk"},
45
+ groups: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/groups"},
46
+ groupMemberships: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/groupMemberships"}
47
+ }
52
48
 
53
- LINKEDIN_ACCOUNT = {
54
- href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7",
55
- username: "nenad.nikolic",
56
- email: "nnikolic87@gmail.com",
57
- givenName: "Nenad",
58
- middleName: nil,
59
- surname: "Nikolic",
60
- fullName: "Nenad Nikolic",
61
- status: "ENABLED",
62
- emailVerificationToken: nil,
63
- customData: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/customData"},
64
- providerData: { href:"https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/providerData"},
65
- directory: { href: "https://api.stormpath.com/v1/directories/7ibyn2idP1d9p3qJOomeNP"},
66
- tenant: { href: "https://api.stormpath.com/v1/tenants/60bD3bKLej6JoFhyKFHiOk"},
67
- groups: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/groups"},
68
- groupMemberships: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/groupMemberships"}
69
- }
49
+ FACEBOOK_PROVIDER_DATA = {
50
+ href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/providerData",
51
+ createdAt: "2014-05-19T13:32:16.884Z",
52
+ modifiedAt: "2014-05-19T13:32:16.927Z",
53
+ accessToken: "CAATmZBgxF6rMBAPYbfBhGrVPRw27nn9fAz6bR0DBV1XGfOcSYXSBrhZCkE1y1lWue348fboRxqX7nz88KBYi05qCHw4AQoZCqyIaWedEXrV2vFVzVHo2glq6Vb1ofAWcEHva7baZAaojA8KN5DVz4UTToKgvoIMa1kjyvZCmFZBpYXoG7H3aIKoyWJzUGCDIUrcFjvjnNZBvAZDZD",
54
+ providerId: "facebook"
55
+ }
70
56
 
71
- LINKEDIN_PROVIDER_DATA = {
72
- href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/providerData",
73
- createdAt: "2014-05-19T13:32:16.884Z",
74
- modifiedAt: "2014-05-19T13:32:16.927Z",
75
- accessToken: "CAATmZBgxF6rMBAPYbfBhGrVPRw27nn9fAz6bR0DBV1XGfOcSYXSBrhZCkE1y1lWue348fboRxqX7nz88KBYi05qCHw4AQoZCqyIaWedEXrV2vFVzVHo2glq6Vb1ofAWcEHva7baZAaojA8KN5DVz4UTToKgvoIMa1kjyvZCmFZBpYXoG7H3aIKoyWJzUGCDIUrcFjvjnNZBvAZDZD",
76
- providerId: "linkedin"
77
- }
57
+ LINKEDIN_ACCOUNT = {
58
+ href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7",
59
+ username: "nenad.nikolic",
60
+ email: "nnikolic87@gmail.com",
61
+ givenName: "Nenad",
62
+ middleName: nil,
63
+ surname: "Nikolic",
64
+ fullName: "Nenad Nikolic",
65
+ status: "ENABLED",
66
+ emailVerificationToken: nil,
67
+ customData: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/customData"},
68
+ providerData: { href:"https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/providerData"},
69
+ directory: { href: "https://api.stormpath.com/v1/directories/7ibyn2idP1d9p3qJOomeNP"},
70
+ tenant: { href: "https://api.stormpath.com/v1/tenants/60bD3bKLej6JoFhyKFHiOk"},
71
+ groups: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/groups"},
72
+ groupMemberships: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/groupMemberships"}
73
+ }
78
74
 
79
- GITHUB_ACCOUNT = {
80
- href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7",
81
- username: "nenad.nikolic",
82
- email: "nnikolic87@gmail.com",
83
- givenName: "Nenad",
84
- middleName: nil,
85
- surname: "Nikolic",
86
- fullName: "Nenad Nikolic",
87
- status: "ENABLED",
88
- emailVerificationToken: nil,
89
- customData: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/customData"},
90
- providerData: { href:"https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/providerData"},
91
- directory: { href: "https://api.stormpath.com/v1/directories/7ibyn2idP1d9p3qJOomeNP"},
92
- tenant: { href: "https://api.stormpath.com/v1/tenants/60bD3bKLej6JoFhyKFHiOk"},
93
- groups: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/groups"},
94
- groupMemberships: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/groupMemberships"}
95
- }
75
+ LINKEDIN_PROVIDER_DATA = {
76
+ href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/providerData",
77
+ createdAt: "2014-05-19T13:32:16.884Z",
78
+ modifiedAt: "2014-05-19T13:32:16.927Z",
79
+ accessToken: "CAATmZBgxF6rMBAPYbfBhGrVPRw27nn9fAz6bR0DBV1XGfOcSYXSBrhZCkE1y1lWue348fboRxqX7nz88KBYi05qCHw4AQoZCqyIaWedEXrV2vFVzVHo2glq6Vb1ofAWcEHva7baZAaojA8KN5DVz4UTToKgvoIMa1kjyvZCmFZBpYXoG7H3aIKoyWJzUGCDIUrcFjvjnNZBvAZDZD",
80
+ providerId: "linkedin"
81
+ }
96
82
 
97
- GITHUB_PROVIDER_DATA = {
98
- href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/providerData",
99
- createdAt: "2014-05-19T13:32:16.884Z",
100
- modifiedAt: "2014-05-19T13:32:16.927Z",
101
- accessToken: "CAATmZBgxF6rMBAPYbfBhGrVPRw27nn9fAz6bR0DBV1XGfOcSYXSBrhZCkE1y1lWue348fboRxqX7nz88KBYi05qCHw4AQoZCqyIaWedEXrV2vFVzVHo2glq6Vb1ofAWcEHva7baZAaojA8KN5DVz4UTToKgvoIMa1kjyvZCmFZBpYXoG7H3aIKoyWJzUGCDIUrcFjvjnNZBvAZDZD",
102
- providerId: "github"
103
- }
83
+ GITHUB_ACCOUNT = {
84
+ href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7",
85
+ username: "nenad.nikolic",
86
+ email: "nnikolic87@gmail.com",
87
+ givenName: "Nenad",
88
+ middleName: nil,
89
+ surname: "Nikolic",
90
+ fullName: "Nenad Nikolic",
91
+ status: "ENABLED",
92
+ emailVerificationToken: nil,
93
+ customData: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/customData"},
94
+ providerData: { href:"https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/providerData"},
95
+ directory: { href: "https://api.stormpath.com/v1/directories/7ibyn2idP1d9p3qJOomeNP"},
96
+ tenant: { href: "https://api.stormpath.com/v1/tenants/60bD3bKLej6JoFhyKFHiOk"},
97
+ groups: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/groups"},
98
+ groupMemberships: { href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/groupMemberships"}
99
+ }
104
100
 
105
- GOOGLE_ACCOUNT = {
106
- href: "https://api.stormpath.com/v1/accounts/2XdHmcyFG8HJCYBTEL1dJj",
107
- username: "damir.svrtan@gmail.com",
108
- email: "damir.svrtan@gmail.com",
109
- givenName: "Damir",
110
- middleName: nil,
111
- surname: "Svrtan",
112
- fullName: "Damir Svrtan",
113
- status: "ENABLED",
114
- emailVerificationToken: nil,
115
- customData: { href: "https://api.stormpath.com/v1/accounts/2XdHmcyFG8HJCYBTEL1dJj/customData" },
116
- providerData: { href: "https://api.stormpath.com/v1/accounts/2XdHmcyFG8HJCYBTEL1dJj/providerData" },
117
- directory: { href: "https://api.stormpath.com/v1/directories/2WU9sRpSn5jpVADlQTAltT" },
118
- tenant: { href: "https://api.stormpath.com/v1/tenants/60bD3bKLej6JoFhyKFHiOk" },
119
- groups: { href: "https://api.stormpath.com/v1/accounts/2XdHmcyFG8HJCYBTEL1dJj/groups" },
120
- groupMemberships: { href: "https://api.stormpath.com/v1/accounts/2XdHmcyFG8HJCYBTEL1dJj/groupMemberships" }
121
- }
101
+ GITHUB_PROVIDER_DATA = {
102
+ href: "https://api.stormpath.com/v1/accounts/7jdiPam0PWES317hwRR5a7/providerData",
103
+ createdAt: "2014-05-19T13:32:16.884Z",
104
+ modifiedAt: "2014-05-19T13:32:16.927Z",
105
+ accessToken: "CAATmZBgxF6rMBAPYbfBhGrVPRw27nn9fAz6bR0DBV1XGfOcSYXSBrhZCkE1y1lWue348fboRxqX7nz88KBYi05qCHw4AQoZCqyIaWedEXrV2vFVzVHo2glq6Vb1ofAWcEHva7baZAaojA8KN5DVz4UTToKgvoIMa1kjyvZCmFZBpYXoG7H3aIKoyWJzUGCDIUrcFjvjnNZBvAZDZD",
106
+ providerId: "github"
107
+ }
122
108
 
123
- GOOGLE_PROVIDER_DATA = {
124
- href: "https://api.stormpath.com/v1/accounts/2XdHmcyFG8HJCYBTEL1dJj/providerData",
125
- createdAt: "2014-05-19T13:34:40.131Z",
126
- modifiedAt: "2014-05-19T13:34:40.172Z",
127
- accessToken: "ya29.GwCFxf7GuqpKOx8AAACnZZvl-TR_UAqpwVHHfUlt-nM_yjVel2FiqjMgAoOtxQ",
128
- providerId: "google",
129
- refreshToken: "Ox8AAACn"
130
- }
109
+ GOOGLE_ACCOUNT = {
110
+ href: "https://api.stormpath.com/v1/accounts/2XdHmcyFG8HJCYBTEL1dJj",
111
+ username: "damir.svrtan@gmail.com",
112
+ email: "damir.svrtan@gmail.com",
113
+ givenName: "Damir",
114
+ middleName: nil,
115
+ surname: "Svrtan",
116
+ fullName: "Damir Svrtan",
117
+ status: "ENABLED",
118
+ emailVerificationToken: nil,
119
+ customData: { href: "https://api.stormpath.com/v1/accounts/2XdHmcyFG8HJCYBTEL1dJj/customData" },
120
+ providerData: { href: "https://api.stormpath.com/v1/accounts/2XdHmcyFG8HJCYBTEL1dJj/providerData" },
121
+ directory: { href: "https://api.stormpath.com/v1/directories/2WU9sRpSn5jpVADlQTAltT" },
122
+ tenant: { href: "https://api.stormpath.com/v1/tenants/60bD3bKLej6JoFhyKFHiOk" },
123
+ groups: { href: "https://api.stormpath.com/v1/accounts/2XdHmcyFG8HJCYBTEL1dJj/groups" },
124
+ groupMemberships: { href: "https://api.stormpath.com/v1/accounts/2XdHmcyFG8HJCYBTEL1dJj/groupMemberships" }
125
+ }
126
+
127
+ GOOGLE_PROVIDER_DATA = {
128
+ href: "https://api.stormpath.com/v1/accounts/2XdHmcyFG8HJCYBTEL1dJj/providerData",
129
+ createdAt: "2014-05-19T13:34:40.131Z",
130
+ modifiedAt: "2014-05-19T13:34:40.172Z",
131
+ accessToken: "ya29.GwCFxf7GuqpKOx8AAACnZZvl-TR_UAqpwVHHfUlt-nM_yjVel2FiqjMgAoOtxQ",
132
+ providerId: "google",
133
+ refreshToken: "Ox8AAACn"
134
+ }
135
+
136
+ STORMPATH_GRANT_RESPONSE = {
137
+ 'access_token' => 'random_access_token',
138
+ 'refresh_token' => 'random_refresh_token',
139
+ 'token_type' => 'Bearer',
140
+ 'expires_in' => 3600,
141
+ 'stormpath_access_token_href' => 'random_href'
142
+ }.freeze
131
143
  end
132
144
  end
File without changes
@@ -25,3 +25,10 @@ RSpec::Matchers.define :be_resource_collection do |expected|
25
25
  end
26
26
  end
27
27
  end
28
+
29
+ RSpec::Matchers.define :have_stt_in_header do |expected|
30
+ match do |jwt|
31
+ header = JSON.parse(Base64.decode64(jwt.split('.').first))
32
+ header.include?('stt') && header['stt'] == expected
33
+ end
34
+ end
File without changes
File without changes
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ describe Stormpath::Util::UriBuilder do
4
+ context 'url contains forward slash' do
5
+ let(:url) { 'https://kfsdlk34223lke:3o5pfd9jlc/s29kf@api.stormpath.com/accounts' }
6
+ let(:builder) { Stormpath::Util::UriBuilder.new(url) }
7
+
8
+ it 'should contain escaped url' do
9
+ expect(builder.escaped_url).to eq 'https://kfsdlk34223lke:3o5pfd9jlc%2Fs29kf@api.stormpath.com/accounts'
10
+ end
11
+
12
+ it 'should contain userinfo' do
13
+ expect(builder.userinfo).to eq 'kfsdlk34223lke:3o5pfd9jlc/s29kf'
14
+ end
15
+
16
+ it 'should contain uri' do
17
+ expect(builder.uri).to eq URI('https://kfsdlk34223lke:3o5pfd9jlc%2Fs29kf@api.stormpath.com/accounts')
18
+ end
19
+ end
20
+
21
+ context "url doesn't contain forward slash" do
22
+ let(:url) { 'https://kfsdlk34223lke:3o5pfd9jlcs29kf@api.stormpath.com/accounts' }
23
+ let(:builder) { Stormpath::Util::UriBuilder.new(url) }
24
+
25
+ it 'should contain escaped url' do
26
+ expect(builder.escaped_url).to eq 'https://kfsdlk34223lke:3o5pfd9jlcs29kf@api.stormpath.com/accounts'
27
+ end
28
+
29
+ it 'should contain userinfo' do
30
+ expect(builder.userinfo).to eq 'kfsdlk34223lke:3o5pfd9jlcs29kf'
31
+ end
32
+
33
+ it 'should contain uri' do
34
+ expect(builder.uri).to eq URI('https://kfsdlk34223lke:3o5pfd9jlcs29kf@api.stormpath.com/accounts')
35
+ end
36
+ end
37
+
38
+ context 'url is invalid' do
39
+ let(:url) { 'invalid url' }
40
+
41
+ it 'should raise error' do
42
+ expect do
43
+ Stormpath::Util::UriBuilder.new(url).uri
44
+ end.to raise_error
45
+ end
46
+ end
47
+ end
@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
38
38
  s.add_development_dependency 'vcr', '~> 2.9.2'
39
39
  s.add_development_dependency 'timecop', '~> 0.6.1'
40
40
  s.add_development_dependency 'redis', '~> 3.0.4'
41
+ s.add_development_dependency 'memcached', '~> 1.8.0'
41
42
  s.add_development_dependency 'listen', '~> 3.0.6'
42
43
 
43
44
  s.rdoc_options = ['--line-numbers', '--inline-source', '--title', 'stormpath-sdk', '--main']
data/support/api.rb CHANGED
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stormpath-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stormpath, Inc
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-24 00:00:00.000000000 Z
12
+ date: 2016-10-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
@@ -263,6 +263,20 @@ dependencies:
263
263
  - - "~>"
264
264
  - !ruby/object:Gem::Version
265
265
  version: 3.0.4
266
+ - !ruby/object:Gem::Dependency
267
+ name: memcached
268
+ requirement: !ruby/object:Gem::Requirement
269
+ requirements:
270
+ - - "~>"
271
+ - !ruby/object:Gem::Version
272
+ version: 1.8.0
273
+ type: :development
274
+ prerelease: false
275
+ version_requirements: !ruby/object:Gem::Requirement
276
+ requirements:
277
+ - - "~>"
278
+ - !ruby/object:Gem::Version
279
+ version: 1.8.0
266
280
  - !ruby/object:Gem::Dependency
267
281
  name: listen
268
282
  requirement: !ruby/object:Gem::Requirement
@@ -295,12 +309,15 @@ files:
295
309
  - lib/stormpath-sdk/auth/authentication_result.rb
296
310
  - lib/stormpath-sdk/auth/basic_authenticator.rb
297
311
  - lib/stormpath-sdk/auth/basic_login_attempt.rb
312
+ - lib/stormpath-sdk/auth/http_basic_authentication.rb
313
+ - lib/stormpath-sdk/auth/http_bearer_authentication.rb
298
314
  - lib/stormpath-sdk/auth/username_password_request.rb
299
315
  - lib/stormpath-sdk/cache/cache.rb
300
316
  - lib/stormpath-sdk/cache/cache_entry.rb
301
317
  - lib/stormpath-sdk/cache/cache_manager.rb
302
318
  - lib/stormpath-sdk/cache/cache_stats.rb
303
319
  - lib/stormpath-sdk/cache/disabled_cache_store.rb
320
+ - lib/stormpath-sdk/cache/memcached_store.rb
304
321
  - lib/stormpath-sdk/cache/memory_store.rb
305
322
  - lib/stormpath-sdk/cache/redis_store.rb
306
323
  - lib/stormpath-sdk/client.rb
@@ -319,14 +336,18 @@ files:
319
336
  - lib/stormpath-sdk/oauth/error.rb
320
337
  - lib/stormpath-sdk/oauth/id_site_grant.rb
321
338
  - lib/stormpath-sdk/oauth/id_site_grant_request.rb
339
+ - lib/stormpath-sdk/oauth/local_access_token_verification.rb
322
340
  - lib/stormpath-sdk/oauth/password_grant.rb
323
341
  - lib/stormpath-sdk/oauth/password_grant_request.rb
324
342
  - lib/stormpath-sdk/oauth/refresh_grant_request.rb
325
343
  - lib/stormpath-sdk/oauth/refresh_token.rb
344
+ - lib/stormpath-sdk/oauth/remote_access_token_verification.rb
345
+ - lib/stormpath-sdk/oauth/social_grant.rb
346
+ - lib/stormpath-sdk/oauth/social_grant_request.rb
326
347
  - lib/stormpath-sdk/oauth/stormpath_grant_request.rb
327
348
  - lib/stormpath-sdk/oauth/stormpath_token_grant.rb
328
349
  - lib/stormpath-sdk/oauth/verify_access_token.rb
329
- - lib/stormpath-sdk/oauth/verify_token.rb
350
+ - lib/stormpath-sdk/oauth/verify_token_result.rb
330
351
  - lib/stormpath-sdk/provider/account_access.rb
331
352
  - lib/stormpath-sdk/provider/account_request.rb
332
353
  - lib/stormpath-sdk/provider/account_resolver.rb
@@ -381,9 +402,12 @@ files:
381
402
  - lib/stormpath-sdk/resource/utils.rb
382
403
  - lib/stormpath-sdk/resource/verification_email.rb
383
404
  - lib/stormpath-sdk/util/assert.rb
405
+ - lib/stormpath-sdk/util/uri_builder.rb
384
406
  - lib/stormpath-sdk/version.rb
385
407
  - spec/api_key_spec.rb
386
408
  - spec/auth/basic_authenticator_spec.rb
409
+ - spec/auth/http_basic_authentication_spec.rb
410
+ - spec/auth/http_bearer_authentication_spec.rb
387
411
  - spec/auth/sauthc1_signer_spec.rb
388
412
  - spec/cache/cache_entry_spec.rb
389
413
  - spec/cache/cache_spec.rb
@@ -423,6 +447,7 @@ files:
423
447
  - spec/support/resource_matchers.rb
424
448
  - spec/support/test_cache_stores.rb
425
449
  - spec/support/test_request_executor.rb
450
+ - spec/util/uri_builder_spec.rb
426
451
  - stormpath-sdk.gemspec
427
452
  - support/api.rb
428
453
  homepage: https://github.com/stormpath/stormpath-sdk-ruby
@@ -450,7 +475,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
450
475
  version: '0'
451
476
  requirements: []
452
477
  rubyforge_project:
453
- rubygems_version: 2.5.1
478
+ rubygems_version: 2.6.6
454
479
  signing_key:
455
480
  specification_version: 4
456
481
  summary: Stormpath SDK