files.com 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/_VERSION +1 -1
- data/docs/sso_strategy.md +2 -0
- data/lib/files.com/errors.rb +10 -9
- data/lib/files.com/models/sso_strategy.rb +5 -0
- data/lib/files.com/version.rb +1 -1
- data/spec/lib/api_client_spec.rb +35 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c2e0388803cdaac806fb010497a65b76610cbfe6aed1e53214b4577ad2ce123
|
4
|
+
data.tar.gz: 3e868d57eb91c00238e0b3433fd2be29eb1ed1a19e16376cdf7545480a19a3e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c06383e3d14e002b59e131c3e8309edb8c393c71307a1b452f92fd136fc942456f82ae09c93146ef2d0f472ac1fd0e2c07c65b29d9d47a186ed1662a4d64807d
|
7
|
+
data.tar.gz: 3ef209022f4312e96149d28d10da8214c2b1b63582c52b65a4535bd6945a166d00dd8c26af1217ca76b6bba986beea54f6a01dfb6637e57b2df62d9fdfd01271
|
data/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.5
|
data/docs/sso_strategy.md
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
"label": "My Corporate SSO Provider",
|
10
10
|
"logo_url": "https://mysite.files.com/.../logo.png",
|
11
11
|
"id": 1,
|
12
|
+
"user_count": 1,
|
12
13
|
"saml_provider_cert_fingerprint": "example",
|
13
14
|
"saml_provider_issuer_url": "example",
|
14
15
|
"saml_provider_metadata_content": "example",
|
@@ -56,6 +57,7 @@
|
|
56
57
|
* `label` (string): Custom label for the SSO provider on the login page.
|
57
58
|
* `logo_url` (string): URL holding a custom logo for the SSO provider on the login page.
|
58
59
|
* `id` (int64): ID
|
60
|
+
* `user_count` (int64): Count of users with this SSO Strategy
|
59
61
|
* `saml_provider_cert_fingerprint` (string): Identity provider sha256 cert fingerprint if saml_provider_metadata_url is not available.
|
60
62
|
* `saml_provider_issuer_url` (string): Identity provider issuer url
|
61
63
|
* `saml_provider_metadata_content` (string): Custom identity provider metadata
|
data/lib/files.com/errors.rb
CHANGED
@@ -28,17 +28,18 @@ module Files
|
|
28
28
|
class NotImplementedError < Error; end
|
29
29
|
|
30
30
|
class APIError < Error
|
31
|
-
attr_reader :detail, :error, :errors, :http_code, :instance, :model_errors, :title, :type
|
31
|
+
attr_reader :detail, :error, :errors, :http_code, :instance, :model_errors, :title, :type, :data
|
32
32
|
|
33
33
|
def initialize(message = nil, **kwargs)
|
34
|
-
@detail = kwargs.dig(:json_body,
|
35
|
-
@error = kwargs.dig(:json_body,
|
36
|
-
@errors = kwargs.dig(:json_body,
|
37
|
-
@http_code = kwargs.dig(:json_body, 'http-code')
|
38
|
-
@instance = kwargs.dig(:json_body,
|
39
|
-
@model_errors = kwargs.dig(:json_body,
|
40
|
-
@title = kwargs.dig(:json_body,
|
41
|
-
@type = kwargs.dig(:json_body,
|
34
|
+
@detail = kwargs.dig(:json_body, :detail)
|
35
|
+
@error = kwargs.dig(:json_body, :error)
|
36
|
+
@errors = kwargs.dig(:json_body, :errors)
|
37
|
+
@http_code = kwargs.dig(:json_body, :'http-code')
|
38
|
+
@instance = kwargs.dig(:json_body, :instance)
|
39
|
+
@model_errors = kwargs.dig(:json_body, :model_errors)
|
40
|
+
@title = kwargs.dig(:json_body, :title)
|
41
|
+
@type = kwargs.dig(:json_body, :type)
|
42
|
+
@data = kwargs.dig(:json_body, :data)
|
42
43
|
|
43
44
|
super(message, **kwargs)
|
44
45
|
end
|
@@ -34,6 +34,11 @@ module Files
|
|
34
34
|
@attributes[:id]
|
35
35
|
end
|
36
36
|
|
37
|
+
# int64 - Count of users with this SSO Strategy
|
38
|
+
def user_count
|
39
|
+
@attributes[:user_count]
|
40
|
+
end
|
41
|
+
|
37
42
|
# string - Identity provider sha256 cert fingerprint if saml_provider_metadata_url is not available.
|
38
43
|
def saml_provider_cert_fingerprint
|
39
44
|
@attributes[:saml_provider_cert_fingerprint]
|
data/lib/files.com/version.rb
CHANGED
data/spec/lib/api_client_spec.rb
CHANGED
@@ -53,12 +53,24 @@ RSpec.describe Files::ApiClient do
|
|
53
53
|
type: "bad-request/request-param-path-cannot-have-trailing-whitespace"
|
54
54
|
}
|
55
55
|
}
|
56
|
+
let(:bad_region_request_with_data) {
|
57
|
+
{
|
58
|
+
error: "You have connected to a URL that has different security settings than those required for your site.",
|
59
|
+
'http-code': 403,
|
60
|
+
title: "Lockout Region Mismatch",
|
61
|
+
type: "not-authenticated/lockout-region-mismatch",
|
62
|
+
data: {
|
63
|
+
host: "test.host"
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}
|
56
67
|
let(:bad_request_without_data) {
|
57
68
|
{
|
58
69
|
error: 'Bad Request'
|
59
70
|
}
|
60
71
|
}
|
61
72
|
let(:mock_good_response) { { status: 400, headers: {}, body: bad_request_with_data.to_json } }
|
73
|
+
let(:mock_good_region_response) { { status: 403, headers: {}, body: bad_region_request_with_data.to_json } }
|
62
74
|
let(:mock_response_without_type) { { status: 400, headers: {}, body: bad_request_without_data.to_json } }
|
63
75
|
let(:mock_empty_response) { { status: 400, headers: {}, body: '' } }
|
64
76
|
|
@@ -66,7 +78,14 @@ RSpec.describe Files::ApiClient do
|
|
66
78
|
allow(subject).to receive(:log_request).and_raise(Faraday::BadRequestError.new('', mock_good_response))
|
67
79
|
expect {
|
68
80
|
subject.execute_request_with_rescues(1, context) { 'empty block' }
|
69
|
-
}.to raise_error
|
81
|
+
}.to raise_error do |error|
|
82
|
+
expect(error).to be_a(Files::RequestParamPathCannotHaveTrailingWhitespaceError)
|
83
|
+
expect(error.message).to eq bad_request_with_data[:error]
|
84
|
+
expect(error.title).to eq "Request Param Path Cannot Have Trailing Whitespace"
|
85
|
+
expect(error.type).to eq "bad-request/request-param-path-cannot-have-trailing-whitespace"
|
86
|
+
expect(error.http_code).to eq 400
|
87
|
+
expect(error.data).to be_nil
|
88
|
+
end
|
70
89
|
end
|
71
90
|
|
72
91
|
it "throws generic bad request error when no type" do
|
@@ -82,5 +101,20 @@ RSpec.describe Files::ApiClient do
|
|
82
101
|
subject.execute_request_with_rescues(1, context) { 'empty block' }
|
83
102
|
}.to raise_error(Files::APIConnectionError)
|
84
103
|
end
|
104
|
+
|
105
|
+
it "handles region lockout error response" do
|
106
|
+
allow(subject).to receive(:log_request).and_raise(Faraday::BadRequestError.new('', mock_good_region_response))
|
107
|
+
expect {
|
108
|
+
subject.execute_request_with_rescues(1, context) { 'empty block' }
|
109
|
+
}.to raise_error do |error|
|
110
|
+
expect(error).to be_a(Files::LockoutRegionMismatchError)
|
111
|
+
expect(error.message).to eq bad_region_request_with_data[:error]
|
112
|
+
expect(error.title).to eq "Lockout Region Mismatch"
|
113
|
+
expect(error.type).to eq "not-authenticated/lockout-region-mismatch"
|
114
|
+
expect(error.http_code).to eq 403
|
115
|
+
expect(error.data).to have_key(:host)
|
116
|
+
expect(error.data[:host]).to eq "test.host"
|
117
|
+
end
|
118
|
+
end
|
85
119
|
end
|
86
120
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: files.com
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- files.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|