stormpath-sdk 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -0
  3. data/.ruby-gemset +0 -0
  4. data/.travis.yml +0 -0
  5. data/CHANGES.md +10 -0
  6. data/Gemfile +0 -0
  7. data/README.md +0 -0
  8. data/Rakefile +0 -0
  9. data/lib/stormpath-sdk.rb +7 -2
  10. data/lib/stormpath-sdk/api_key.rb +0 -0
  11. data/lib/stormpath-sdk/auth/authentication_result.rb +0 -0
  12. data/lib/stormpath-sdk/auth/basic_authenticator.rb +0 -0
  13. data/lib/stormpath-sdk/auth/basic_login_attempt.rb +0 -0
  14. data/lib/stormpath-sdk/auth/username_password_request.rb +0 -0
  15. data/lib/stormpath-sdk/cache/cache.rb +0 -0
  16. data/lib/stormpath-sdk/cache/cache_entry.rb +0 -0
  17. data/lib/stormpath-sdk/cache/cache_manager.rb +0 -0
  18. data/lib/stormpath-sdk/cache/cache_stats.rb +0 -0
  19. data/lib/stormpath-sdk/cache/disabled_cache_store.rb +0 -0
  20. data/lib/stormpath-sdk/cache/memory_store.rb +0 -0
  21. data/lib/stormpath-sdk/cache/redis_store.rb +0 -0
  22. data/lib/stormpath-sdk/client.rb +0 -0
  23. data/lib/stormpath-sdk/data_store.rb +0 -0
  24. data/lib/stormpath-sdk/error.rb +0 -0
  25. data/lib/stormpath-sdk/http/authc/sauthc1_signer.rb +0 -0
  26. data/lib/stormpath-sdk/http/http_client_request_executor.rb +0 -0
  27. data/lib/stormpath-sdk/http/request.rb +0 -0
  28. data/lib/stormpath-sdk/http/response.rb +0 -0
  29. data/lib/stormpath-sdk/http/utils.rb +0 -0
  30. data/lib/stormpath-sdk/id_site/id_site_result.rb +0 -0
  31. data/lib/stormpath-sdk/oauth/access_token_authentication_result.rb +0 -0
  32. data/lib/stormpath-sdk/oauth/authenticator.rb +11 -10
  33. data/lib/stormpath-sdk/oauth/error.rb +0 -0
  34. data/lib/stormpath-sdk/oauth/id_site_grant.rb +0 -0
  35. data/lib/stormpath-sdk/oauth/id_site_grant_request.rb +0 -0
  36. data/lib/stormpath-sdk/oauth/password_grant.rb +0 -0
  37. data/lib/stormpath-sdk/oauth/password_grant_request.rb +0 -0
  38. data/lib/stormpath-sdk/oauth/refresh_grant_request.rb +0 -0
  39. data/lib/stormpath-sdk/oauth/refresh_token.rb +0 -0
  40. data/lib/stormpath-sdk/oauth/stormpath_grant_request.rb +33 -0
  41. data/lib/stormpath-sdk/oauth/stormpath_token_grant.rb +16 -0
  42. data/lib/stormpath-sdk/oauth/verify_access_token.rb +0 -0
  43. data/lib/stormpath-sdk/oauth/verify_token.rb +0 -0
  44. data/lib/stormpath-sdk/provider/account_access.rb +0 -0
  45. data/lib/stormpath-sdk/provider/account_request.rb +0 -0
  46. data/lib/stormpath-sdk/provider/account_resolver.rb +0 -0
  47. data/lib/stormpath-sdk/provider/account_result.rb +0 -0
  48. data/lib/stormpath-sdk/provider/facebook/facebook_provider.rb +0 -0
  49. data/lib/stormpath-sdk/provider/facebook/facebook_provider_data.rb +0 -0
  50. data/lib/stormpath-sdk/provider/github/github_provider.rb +0 -0
  51. data/lib/stormpath-sdk/provider/github/github_provider_data.rb +0 -0
  52. data/lib/stormpath-sdk/provider/google/google_provider.rb +0 -0
  53. data/lib/stormpath-sdk/provider/google/google_provider_data.rb +0 -0
  54. data/lib/stormpath-sdk/provider/linkedin/linkedin_provider.rb +0 -0
  55. data/lib/stormpath-sdk/provider/linkedin/linkedin_provider_data.rb +0 -0
  56. data/lib/stormpath-sdk/provider/provider.rb +0 -0
  57. data/lib/stormpath-sdk/provider/provider_data.rb +0 -0
  58. data/lib/stormpath-sdk/provider/saml/saml_mapping_rules.rb +0 -0
  59. data/lib/stormpath-sdk/provider/saml/saml_provider.rb +0 -0
  60. data/lib/stormpath-sdk/provider/saml/saml_provider_data.rb +0 -0
  61. data/lib/stormpath-sdk/provider/saml/saml_provider_metadata.rb +0 -0
  62. data/lib/stormpath-sdk/provider/stormpath/stormpath_provider.rb +0 -0
  63. data/lib/stormpath-sdk/provider/stormpath/stormpath_provider_data.rb +0 -0
  64. data/lib/stormpath-sdk/resource/access_token.rb +0 -0
  65. data/lib/stormpath-sdk/resource/account.rb +3 -2
  66. data/lib/stormpath-sdk/resource/account_creation_policy.rb +15 -0
  67. data/lib/stormpath-sdk/resource/account_membership.rb +0 -0
  68. data/lib/stormpath-sdk/resource/account_overrides.rb +0 -0
  69. data/lib/stormpath-sdk/resource/account_store.rb +0 -0
  70. data/lib/stormpath-sdk/resource/account_store_mapping.rb +0 -0
  71. data/lib/stormpath-sdk/resource/{account_status.rb → api_key.rb} +9 -9
  72. data/lib/stormpath-sdk/resource/application.rb +2 -2
  73. data/lib/stormpath-sdk/resource/associations.rb +2 -1
  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 +3 -2
  80. data/lib/stormpath-sdk/resource/email_template.rb +7 -0
  81. data/lib/stormpath-sdk/resource/email_verification_token.rb +0 -0
  82. data/lib/stormpath-sdk/resource/error.rb +0 -0
  83. data/lib/stormpath-sdk/resource/expansion.rb +0 -0
  84. data/lib/stormpath-sdk/resource/group.rb +1 -2
  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 +0 -0
  89. data/lib/stormpath-sdk/resource/organization_account_store_mapping.rb +0 -0
  90. data/lib/stormpath-sdk/resource/password_policy.rb +10 -0
  91. data/lib/stormpath-sdk/resource/password_reset_token.rb +0 -0
  92. data/lib/stormpath-sdk/resource/password_strength.rb +16 -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/version.rb +1 -1
  99. data/spec/api_key_spec.rb +0 -0
  100. data/spec/auth/basic_authenticator_spec.rb +0 -0
  101. data/spec/auth/sauthc1_signer_spec.rb +0 -0
  102. data/spec/cache/cache_entry_spec.rb +0 -0
  103. data/spec/cache/cache_spec.rb +0 -0
  104. data/spec/cache/cache_stats_spec.rb +0 -0
  105. data/spec/client_spec.rb +1 -1
  106. data/spec/data_store_spec.rb +0 -0
  107. data/spec/fixtures/response/create_saml_directory.json +0 -0
  108. data/spec/fixtures/response/create_saml_directory_mapping_rules.json +0 -0
  109. data/spec/fixtures/response/get_saml_directory_provider.json +0 -0
  110. data/spec/fixtures/response/get_saml_directory_provider_metadata.json +0 -0
  111. data/spec/oauth/access_token_authentication_result_spec.rb +0 -0
  112. data/spec/provider/account_resolver_spec.rb +0 -0
  113. data/spec/provider/provider_spec.rb +0 -0
  114. data/spec/resource/account_creation_policy_spec.rb +61 -0
  115. data/spec/resource/account_store_mapping_spec.rb +0 -0
  116. data/spec/resource/account_store_spec.rb +0 -0
  117. data/spec/resource/api_key_spec.rb +56 -0
  118. data/spec/resource/application_spec.rb +26 -3
  119. data/spec/resource/base_spec.rb +0 -0
  120. data/spec/resource/collection_spec.rb +0 -0
  121. data/spec/resource/custom_data_spec.rb +0 -0
  122. data/spec/resource/directory_spec.rb +13 -4
  123. data/spec/resource/email_template_spec.rb +59 -0
  124. data/spec/resource/expansion_spec.rb +0 -0
  125. data/spec/resource/group_membership_spec.rb +0 -0
  126. data/spec/resource/group_spec.rb +0 -0
  127. data/spec/resource/organization_spec.rb +0 -0
  128. data/spec/resource/password_policy_spec.rb +58 -0
  129. data/spec/resource/password_strength_spec.rb +69 -0
  130. data/spec/resource/status_spec.rb +2 -16
  131. data/spec/resource/tenant_spec.rb +0 -0
  132. data/spec/spec_helper.rb +0 -0
  133. data/spec/support/custom_data_storage_behavior.rb +0 -0
  134. data/spec/support/mocked_provider_accounts.rb +0 -0
  135. data/spec/support/resource_factory.rb +0 -0
  136. data/spec/support/resource_matchers.rb +0 -0
  137. data/spec/support/test_cache_stores.rb +0 -0
  138. data/spec/support/test_request_executor.rb +0 -0
  139. data/stormpath-sdk.gemspec +0 -0
  140. data/support/api.rb +0 -0
  141. metadata +13 -3
  142. data/lib/stormpath-sdk/resource/status.rb +0 -39
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+
3
+ describe Stormpath::Resource::PasswordStrength, :vcr do
4
+ describe "instances should respond to attribute property methods" do
5
+ let(:application) { test_application }
6
+ let(:directory) { test_api_client.directories.create(name: random_directory_name) }
7
+ let(:password_policy) { directory.password_policy }
8
+ let(:password_strength) { password_policy.strength }
9
+
10
+ before do
11
+ test_api_client.account_store_mappings.create(
12
+ application: application,
13
+ account_store: directory,
14
+ list_index: 1,
15
+ is_default_account_store: false,
16
+ is_default_group_store: false
17
+ )
18
+ end
19
+
20
+ after { directory.delete }
21
+
22
+ it do
23
+ expect(password_strength).to be_a Stormpath::Resource::PasswordStrength
24
+
25
+ [ :min_length,
26
+ :max_length,
27
+ :min_lower_case,
28
+ :min_upper_case,
29
+ :min_numeric,
30
+ :min_symbol,
31
+ :min_diacritic,
32
+ :prevent_reuse].each do |property_accessor|
33
+ expect(password_strength).to respond_to(property_accessor)
34
+ expect(password_strength).to respond_to("#{property_accessor}=")
35
+ end
36
+ end
37
+
38
+ it 'can change attributes' do
39
+ expect(password_policy.strength.min_length).to eq(8)
40
+ expect(password_policy.strength.max_length).to eq(100)
41
+ expect(password_policy.strength.min_lower_case).to eq(1)
42
+ expect(password_policy.strength.min_upper_case).to eq(1)
43
+ expect(password_policy.strength.min_numeric).to eq(1)
44
+ expect(password_policy.strength.min_symbol).to eq(0)
45
+ expect(password_policy.strength.min_diacritic).to eq(0)
46
+ expect(password_policy.strength.prevent_reuse).to eq(0)
47
+
48
+ password_strength.min_length = 10
49
+ password_strength.max_length = 99
50
+ password_strength.min_lower_case = 2
51
+ password_strength.min_upper_case = 2
52
+ password_strength.min_numeric = 2
53
+ password_strength.min_symbol = 1
54
+ password_strength.min_diacritic = 1
55
+ password_strength.prevent_reuse = 1
56
+
57
+ password_strength.save
58
+
59
+ expect(password_policy.strength.min_length).to eq(10)
60
+ expect(password_policy.strength.max_length).to eq(99)
61
+ expect(password_policy.strength.min_lower_case).to eq(2)
62
+ expect(password_policy.strength.min_upper_case).to eq(2)
63
+ expect(password_policy.strength.min_numeric).to eq(2)
64
+ expect(password_policy.strength.min_symbol).to eq(1)
65
+ expect(password_policy.strength.min_diacritic).to eq(1)
66
+ expect(password_policy.strength.prevent_reuse).to eq(1)
67
+ end
68
+ end
69
+ end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe Stormpath::Resource::Status, :vcr do
4
-
3
+ describe 'status', :vcr do
5
4
  def authenticate_user
6
5
  auth_request = Stormpath::Authentication::UsernamePasswordRequest.new 'test@example.com', 'P@$$w0rd'
7
6
  account_store_mapping unless account_store_mapping
@@ -18,10 +17,6 @@ describe Stormpath::Resource::Status, :vcr do
18
17
 
19
18
  let!(:account) { directory.accounts.create email: 'test@example.com', password: 'P@$$w0rd', given_name: "Ruby SDK", surname: 'SDK' }
20
19
 
21
- let(:status_hash) {{ "ENABLED" => "ENABLED", "DISABLED" => "DISABLED" }}
22
-
23
- let(:account_status_hash) { status_hash.merge "UNVERIFIED" => "UNVERIFIED", "LOCKED" => "LOCKED"}
24
-
25
20
  let(:reloaded_account) { test_api_client.accounts.get account.href }
26
21
 
27
22
  after do
@@ -43,14 +38,6 @@ describe Stormpath::Resource::Status, :vcr do
43
38
  expect(account.respond_to? :status=).to be_truthy
44
39
  end
45
40
 
46
- it "compare status hashes" do
47
- expect(directory.status_hash).to eq(status_hash)
48
- expect(application.status_hash).to eq(status_hash)
49
-
50
- expect(group.status_hash).to eq(status_hash)
51
- expect(account.status_hash).to eq(account_status_hash)
52
- end
53
-
54
41
  it "users status by default should be ENABLED" do
55
42
  expect(account.status).to eq("ENABLED")
56
43
  end
@@ -75,7 +62,6 @@ describe Stormpath::Resource::Status, :vcr do
75
62
 
76
63
  it 'assigning inappropriate status states should fail silently' do
77
64
  account.status = "INVALID_STATUS_VALUE"
78
- expect(account.status).to eq("ENABLED")
65
+ expect { account.save }.to raise_error(Stormpath::Error)
79
66
  end
80
-
81
67
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
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.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stormpath, Inc
@@ -321,6 +321,8 @@ files:
321
321
  - lib/stormpath-sdk/oauth/password_grant_request.rb
322
322
  - lib/stormpath-sdk/oauth/refresh_grant_request.rb
323
323
  - lib/stormpath-sdk/oauth/refresh_token.rb
324
+ - lib/stormpath-sdk/oauth/stormpath_grant_request.rb
325
+ - lib/stormpath-sdk/oauth/stormpath_token_grant.rb
324
326
  - lib/stormpath-sdk/oauth/verify_access_token.rb
325
327
  - lib/stormpath-sdk/oauth/verify_token.rb
326
328
  - lib/stormpath-sdk/provider/account_access.rb
@@ -345,11 +347,12 @@ files:
345
347
  - lib/stormpath-sdk/provider/stormpath/stormpath_provider_data.rb
346
348
  - lib/stormpath-sdk/resource/access_token.rb
347
349
  - lib/stormpath-sdk/resource/account.rb
350
+ - lib/stormpath-sdk/resource/account_creation_policy.rb
348
351
  - lib/stormpath-sdk/resource/account_membership.rb
349
352
  - lib/stormpath-sdk/resource/account_overrides.rb
350
- - lib/stormpath-sdk/resource/account_status.rb
351
353
  - lib/stormpath-sdk/resource/account_store.rb
352
354
  - lib/stormpath-sdk/resource/account_store_mapping.rb
355
+ - lib/stormpath-sdk/resource/api_key.rb
353
356
  - lib/stormpath-sdk/resource/application.rb
354
357
  - lib/stormpath-sdk/resource/associations.rb
355
358
  - lib/stormpath-sdk/resource/base.rb
@@ -358,6 +361,7 @@ files:
358
361
  - lib/stormpath-sdk/resource/custom_data_hash_methods.rb
359
362
  - lib/stormpath-sdk/resource/custom_data_storage.rb
360
363
  - lib/stormpath-sdk/resource/directory.rb
364
+ - lib/stormpath-sdk/resource/email_template.rb
361
365
  - lib/stormpath-sdk/resource/email_verification_token.rb
362
366
  - lib/stormpath-sdk/resource/error.rb
363
367
  - lib/stormpath-sdk/resource/expansion.rb
@@ -367,9 +371,10 @@ files:
367
371
  - lib/stormpath-sdk/resource/oauth_policy.rb
368
372
  - lib/stormpath-sdk/resource/organization.rb
369
373
  - lib/stormpath-sdk/resource/organization_account_store_mapping.rb
374
+ - lib/stormpath-sdk/resource/password_policy.rb
370
375
  - lib/stormpath-sdk/resource/password_reset_token.rb
376
+ - lib/stormpath-sdk/resource/password_strength.rb
371
377
  - lib/stormpath-sdk/resource/refresh_token.rb
372
- - lib/stormpath-sdk/resource/status.rb
373
378
  - lib/stormpath-sdk/resource/tenant.rb
374
379
  - lib/stormpath-sdk/resource/utils.rb
375
380
  - lib/stormpath-sdk/resource/verification_email.rb
@@ -390,18 +395,23 @@ files:
390
395
  - spec/oauth/access_token_authentication_result_spec.rb
391
396
  - spec/provider/account_resolver_spec.rb
392
397
  - spec/provider/provider_spec.rb
398
+ - spec/resource/account_creation_policy_spec.rb
393
399
  - spec/resource/account_spec.rb
394
400
  - spec/resource/account_store_mapping_spec.rb
395
401
  - spec/resource/account_store_spec.rb
402
+ - spec/resource/api_key_spec.rb
396
403
  - spec/resource/application_spec.rb
397
404
  - spec/resource/base_spec.rb
398
405
  - spec/resource/collection_spec.rb
399
406
  - spec/resource/custom_data_spec.rb
400
407
  - spec/resource/directory_spec.rb
408
+ - spec/resource/email_template_spec.rb
401
409
  - spec/resource/expansion_spec.rb
402
410
  - spec/resource/group_membership_spec.rb
403
411
  - spec/resource/group_spec.rb
404
412
  - spec/resource/organization_spec.rb
413
+ - spec/resource/password_policy_spec.rb
414
+ - spec/resource/password_strength_spec.rb
405
415
  - spec/resource/status_spec.rb
406
416
  - spec/resource/tenant_spec.rb
407
417
  - spec/spec_helper.rb
@@ -1,39 +0,0 @@
1
- #
2
- # Copyright 2013 Stormpath, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- #
16
- module Stormpath::Resource::Status
17
-
18
- ENABLED = 'ENABLED'
19
- DISABLED = 'DISABLED'
20
-
21
- def status_hash
22
- {ENABLED => ENABLED, DISABLED => DISABLED}
23
- end
24
-
25
- STATUS = "status"
26
-
27
- def status
28
- value = get_property STATUS
29
- value.upcase! if value
30
- value
31
- end
32
-
33
- def status=(status)
34
- if status_hash.has_key? status
35
- set_property STATUS, status_hash[status]
36
- end
37
- end
38
-
39
- end