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.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/.ruby-gemset +0 -0
- data/.travis.yml +1 -0
- data/CHANGES.md +20 -0
- data/Gemfile +0 -0
- data/README.md +78 -2
- data/Rakefile +0 -0
- 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/http_basic_authentication.rb +47 -0
- data/lib/stormpath-sdk/auth/http_bearer_authentication.rb +27 -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/memcached_store.rb +37 -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 +1 -0
- data/lib/stormpath-sdk/error.rb +5 -5
- data/lib/stormpath-sdk/http/authc/sauthc1_signer.rb +0 -0
- data/lib/stormpath-sdk/http/http_client_request_executor.rb +2 -3
- data/lib/stormpath-sdk/http/request.rb +12 -10
- data/lib/stormpath-sdk/http/response.rb +0 -0
- data/lib/stormpath-sdk/http/utils.rb +8 -5
- 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 +2 -1
- data/lib/stormpath-sdk/oauth/error.rb +12 -8
- data/lib/stormpath-sdk/oauth/id_site_grant_request.rb +0 -0
- data/lib/stormpath-sdk/oauth/local_access_token_verification.rb +45 -0
- data/lib/stormpath-sdk/oauth/password_grant.rb +9 -7
- data/lib/stormpath-sdk/oauth/password_grant_request.rb +3 -2
- data/lib/stormpath-sdk/oauth/refresh_grant_request.rb +0 -0
- data/lib/stormpath-sdk/oauth/remote_access_token_verification.rb +28 -0
- data/lib/stormpath-sdk/oauth/social_grant.rb +27 -0
- data/lib/stormpath-sdk/oauth/social_grant_request.rb +14 -0
- data/lib/stormpath-sdk/oauth/stormpath_grant_request.rb +3 -2
- data/lib/stormpath-sdk/oauth/verify_access_token.rb +11 -6
- data/lib/stormpath-sdk/oauth/{verify_token.rb → verify_token_result.rb} +1 -1
- 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 -1
- 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_creation_policy.rb +3 -1
- 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 +7 -8
- data/lib/stormpath-sdk/resource/account_store_mapping.rb +0 -0
- data/lib/stormpath-sdk/resource/application.rb +5 -5
- 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 +1 -0
- data/lib/stormpath-sdk/resource/email_template.rb +0 -0
- data/lib/stormpath-sdk/resource/email_verification_token.rb +0 -0
- data/lib/stormpath-sdk/resource/error.rb +2 -3
- data/lib/stormpath-sdk/resource/expansion.rb +0 -0
- data/lib/stormpath-sdk/resource/group.rb +0 -0
- 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 +1 -1
- data/lib/stormpath-sdk/resource/organization_account_store_mapping.rb +0 -0
- data/lib/stormpath-sdk/resource/password_policy.rb +0 -0
- data/lib/stormpath-sdk/resource/password_reset_token.rb +0 -0
- data/lib/stormpath-sdk/resource/password_strength.rb +0 -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/util/uri_builder.rb +38 -0
- data/lib/stormpath-sdk/version.rb +2 -2
- data/lib/stormpath-sdk.rb +47 -39
- data/spec/api_key_spec.rb +0 -0
- data/spec/auth/basic_authenticator_spec.rb +0 -0
- data/spec/auth/http_basic_authentication_spec.rb +86 -0
- data/spec/auth/http_bearer_authentication_spec.rb +86 -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 +0 -0
- data/spec/data_store_spec.rb +40 -16
- 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 +8 -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 +125 -2
- data/spec/resource/account_store_mapping_spec.rb +0 -0
- data/spec/resource/account_store_spec.rb +40 -13
- data/spec/resource/application_spec.rb +268 -51
- data/spec/resource/base_spec.rb +0 -0
- data/spec/resource/collection_spec.rb +60 -2
- data/spec/resource/custom_data_spec.rb +0 -0
- data/spec/resource/directory_spec.rb +82 -1
- data/spec/resource/email_template_spec.rb +0 -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 +37 -8
- data/spec/resource/password_policy_spec.rb +0 -0
- data/spec/resource/password_strength_spec.rb +0 -0
- data/spec/resource/status_spec.rb +0 -0
- data/spec/resource/tenant_spec.rb +0 -0
- data/spec/spec_helper.rb +5 -6
- data/spec/support/custom_data_storage_behavior.rb +0 -0
- data/spec/support/mocked_provider_accounts.rb +129 -117
- data/spec/support/resource_factory.rb +0 -0
- data/spec/support/resource_matchers.rb +7 -0
- data/spec/support/test_cache_stores.rb +0 -0
- data/spec/support/test_request_executor.rb +0 -0
- data/spec/util/uri_builder_spec.rb +47 -0
- data/stormpath-sdk.gemspec +1 -0
- data/support/api.rb +0 -0
- 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,
|
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
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
28
|
-
|
29
|
-
|
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
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
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
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
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
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
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
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
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
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
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
|
data/stormpath-sdk.gemspec
CHANGED
@@ -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.
|
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-
|
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/
|
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.
|
478
|
+
rubygems_version: 2.6.6
|
454
479
|
signing_key:
|
455
480
|
specification_version: 4
|
456
481
|
summary: Stormpath SDK
|