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.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/.ruby-gemset +0 -0
- data/.travis.yml +0 -0
- data/CHANGES.md +10 -0
- data/Gemfile +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/lib/stormpath-sdk.rb +7 -2
- data/lib/stormpath-sdk/api_key.rb +0 -0
- data/lib/stormpath-sdk/auth/authentication_result.rb +0 -0
- data/lib/stormpath-sdk/auth/basic_authenticator.rb +0 -0
- data/lib/stormpath-sdk/auth/basic_login_attempt.rb +0 -0
- data/lib/stormpath-sdk/auth/username_password_request.rb +0 -0
- data/lib/stormpath-sdk/cache/cache.rb +0 -0
- data/lib/stormpath-sdk/cache/cache_entry.rb +0 -0
- data/lib/stormpath-sdk/cache/cache_manager.rb +0 -0
- data/lib/stormpath-sdk/cache/cache_stats.rb +0 -0
- data/lib/stormpath-sdk/cache/disabled_cache_store.rb +0 -0
- data/lib/stormpath-sdk/cache/memory_store.rb +0 -0
- data/lib/stormpath-sdk/cache/redis_store.rb +0 -0
- data/lib/stormpath-sdk/client.rb +0 -0
- data/lib/stormpath-sdk/data_store.rb +0 -0
- data/lib/stormpath-sdk/error.rb +0 -0
- data/lib/stormpath-sdk/http/authc/sauthc1_signer.rb +0 -0
- data/lib/stormpath-sdk/http/http_client_request_executor.rb +0 -0
- data/lib/stormpath-sdk/http/request.rb +0 -0
- data/lib/stormpath-sdk/http/response.rb +0 -0
- data/lib/stormpath-sdk/http/utils.rb +0 -0
- data/lib/stormpath-sdk/id_site/id_site_result.rb +0 -0
- data/lib/stormpath-sdk/oauth/access_token_authentication_result.rb +0 -0
- data/lib/stormpath-sdk/oauth/authenticator.rb +11 -10
- data/lib/stormpath-sdk/oauth/error.rb +0 -0
- data/lib/stormpath-sdk/oauth/id_site_grant.rb +0 -0
- data/lib/stormpath-sdk/oauth/id_site_grant_request.rb +0 -0
- data/lib/stormpath-sdk/oauth/password_grant.rb +0 -0
- data/lib/stormpath-sdk/oauth/password_grant_request.rb +0 -0
- data/lib/stormpath-sdk/oauth/refresh_grant_request.rb +0 -0
- data/lib/stormpath-sdk/oauth/refresh_token.rb +0 -0
- data/lib/stormpath-sdk/oauth/stormpath_grant_request.rb +33 -0
- data/lib/stormpath-sdk/oauth/stormpath_token_grant.rb +16 -0
- data/lib/stormpath-sdk/oauth/verify_access_token.rb +0 -0
- data/lib/stormpath-sdk/oauth/verify_token.rb +0 -0
- data/lib/stormpath-sdk/provider/account_access.rb +0 -0
- data/lib/stormpath-sdk/provider/account_request.rb +0 -0
- data/lib/stormpath-sdk/provider/account_resolver.rb +0 -0
- data/lib/stormpath-sdk/provider/account_result.rb +0 -0
- data/lib/stormpath-sdk/provider/facebook/facebook_provider.rb +0 -0
- data/lib/stormpath-sdk/provider/facebook/facebook_provider_data.rb +0 -0
- data/lib/stormpath-sdk/provider/github/github_provider.rb +0 -0
- data/lib/stormpath-sdk/provider/github/github_provider_data.rb +0 -0
- data/lib/stormpath-sdk/provider/google/google_provider.rb +0 -0
- data/lib/stormpath-sdk/provider/google/google_provider_data.rb +0 -0
- data/lib/stormpath-sdk/provider/linkedin/linkedin_provider.rb +0 -0
- data/lib/stormpath-sdk/provider/linkedin/linkedin_provider_data.rb +0 -0
- data/lib/stormpath-sdk/provider/provider.rb +0 -0
- data/lib/stormpath-sdk/provider/provider_data.rb +0 -0
- data/lib/stormpath-sdk/provider/saml/saml_mapping_rules.rb +0 -0
- data/lib/stormpath-sdk/provider/saml/saml_provider.rb +0 -0
- data/lib/stormpath-sdk/provider/saml/saml_provider_data.rb +0 -0
- data/lib/stormpath-sdk/provider/saml/saml_provider_metadata.rb +0 -0
- data/lib/stormpath-sdk/provider/stormpath/stormpath_provider.rb +0 -0
- data/lib/stormpath-sdk/provider/stormpath/stormpath_provider_data.rb +0 -0
- data/lib/stormpath-sdk/resource/access_token.rb +0 -0
- data/lib/stormpath-sdk/resource/account.rb +3 -2
- data/lib/stormpath-sdk/resource/account_creation_policy.rb +15 -0
- data/lib/stormpath-sdk/resource/account_membership.rb +0 -0
- data/lib/stormpath-sdk/resource/account_overrides.rb +0 -0
- data/lib/stormpath-sdk/resource/account_store.rb +0 -0
- data/lib/stormpath-sdk/resource/account_store_mapping.rb +0 -0
- data/lib/stormpath-sdk/resource/{account_status.rb → api_key.rb} +9 -9
- data/lib/stormpath-sdk/resource/application.rb +2 -2
- data/lib/stormpath-sdk/resource/associations.rb +2 -1
- data/lib/stormpath-sdk/resource/base.rb +0 -0
- data/lib/stormpath-sdk/resource/collection.rb +0 -0
- data/lib/stormpath-sdk/resource/custom_data.rb +0 -0
- data/lib/stormpath-sdk/resource/custom_data_hash_methods.rb +0 -0
- data/lib/stormpath-sdk/resource/custom_data_storage.rb +0 -0
- data/lib/stormpath-sdk/resource/directory.rb +3 -2
- data/lib/stormpath-sdk/resource/email_template.rb +7 -0
- data/lib/stormpath-sdk/resource/email_verification_token.rb +0 -0
- data/lib/stormpath-sdk/resource/error.rb +0 -0
- data/lib/stormpath-sdk/resource/expansion.rb +0 -0
- data/lib/stormpath-sdk/resource/group.rb +1 -2
- data/lib/stormpath-sdk/resource/group_membership.rb +0 -0
- data/lib/stormpath-sdk/resource/instance.rb +0 -0
- data/lib/stormpath-sdk/resource/oauth_policy.rb +0 -0
- data/lib/stormpath-sdk/resource/organization.rb +0 -0
- data/lib/stormpath-sdk/resource/organization_account_store_mapping.rb +0 -0
- data/lib/stormpath-sdk/resource/password_policy.rb +10 -0
- data/lib/stormpath-sdk/resource/password_reset_token.rb +0 -0
- data/lib/stormpath-sdk/resource/password_strength.rb +16 -0
- data/lib/stormpath-sdk/resource/refresh_token.rb +0 -0
- data/lib/stormpath-sdk/resource/tenant.rb +0 -0
- data/lib/stormpath-sdk/resource/utils.rb +0 -0
- data/lib/stormpath-sdk/resource/verification_email.rb +0 -0
- data/lib/stormpath-sdk/util/assert.rb +0 -0
- data/lib/stormpath-sdk/version.rb +1 -1
- data/spec/api_key_spec.rb +0 -0
- data/spec/auth/basic_authenticator_spec.rb +0 -0
- data/spec/auth/sauthc1_signer_spec.rb +0 -0
- data/spec/cache/cache_entry_spec.rb +0 -0
- data/spec/cache/cache_spec.rb +0 -0
- data/spec/cache/cache_stats_spec.rb +0 -0
- data/spec/client_spec.rb +1 -1
- data/spec/data_store_spec.rb +0 -0
- data/spec/fixtures/response/create_saml_directory.json +0 -0
- data/spec/fixtures/response/create_saml_directory_mapping_rules.json +0 -0
- data/spec/fixtures/response/get_saml_directory_provider.json +0 -0
- data/spec/fixtures/response/get_saml_directory_provider_metadata.json +0 -0
- data/spec/oauth/access_token_authentication_result_spec.rb +0 -0
- data/spec/provider/account_resolver_spec.rb +0 -0
- data/spec/provider/provider_spec.rb +0 -0
- data/spec/resource/account_creation_policy_spec.rb +61 -0
- data/spec/resource/account_store_mapping_spec.rb +0 -0
- data/spec/resource/account_store_spec.rb +0 -0
- data/spec/resource/api_key_spec.rb +56 -0
- data/spec/resource/application_spec.rb +26 -3
- data/spec/resource/base_spec.rb +0 -0
- data/spec/resource/collection_spec.rb +0 -0
- data/spec/resource/custom_data_spec.rb +0 -0
- data/spec/resource/directory_spec.rb +13 -4
- data/spec/resource/email_template_spec.rb +59 -0
- data/spec/resource/expansion_spec.rb +0 -0
- data/spec/resource/group_membership_spec.rb +0 -0
- data/spec/resource/group_spec.rb +0 -0
- data/spec/resource/organization_spec.rb +0 -0
- data/spec/resource/password_policy_spec.rb +58 -0
- data/spec/resource/password_strength_spec.rb +69 -0
- data/spec/resource/status_spec.rb +2 -16
- data/spec/resource/tenant_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/support/custom_data_storage_behavior.rb +0 -0
- data/spec/support/mocked_provider_accounts.rb +0 -0
- data/spec/support/resource_factory.rb +0 -0
- data/spec/support/resource_matchers.rb +0 -0
- data/spec/support/test_cache_stores.rb +0 -0
- data/spec/support/test_request_executor.rb +0 -0
- data/stormpath-sdk.gemspec +0 -0
- data/support/api.rb +0 -0
- metadata +13 -3
- 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
|
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
|
65
|
+
expect { account.save }.to raise_error(Stormpath::Error)
|
79
66
|
end
|
80
|
-
|
81
67
|
end
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/stormpath-sdk.gemspec
CHANGED
File without changes
|
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.
|
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
|