googleauth 0.14.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +11 -0
- data/CHANGELOG.md +72 -10
- data/README.md +48 -13
- data/SECURITY.md +7 -0
- data/lib/googleauth/application_default.rb +10 -25
- data/lib/googleauth/client_id.rb +10 -25
- data/lib/googleauth/compute_engine.rb +16 -30
- data/lib/googleauth/credentials.rb +178 -74
- data/lib/googleauth/credentials_loader.rb +23 -44
- data/lib/googleauth/default_credentials.rb +10 -25
- data/lib/googleauth/iam.rb +11 -26
- data/lib/googleauth/id_tokens/errors.rb +9 -23
- data/lib/googleauth/id_tokens/key_sources.rb +26 -38
- data/lib/googleauth/id_tokens/verifier.rb +16 -32
- data/lib/googleauth/id_tokens.rb +9 -23
- data/lib/googleauth/json_key_reader.rb +10 -25
- data/lib/googleauth/scope_util.rb +11 -26
- data/lib/googleauth/service_account.rb +60 -59
- data/lib/googleauth/signet.rb +22 -28
- data/lib/googleauth/stores/file_token_store.rb +11 -25
- data/lib/googleauth/stores/redis_token_store.rb +11 -25
- data/lib/googleauth/token_store.rb +10 -25
- data/lib/googleauth/user_authorizer.rb +10 -25
- data/lib/googleauth/user_refresh.rb +15 -27
- data/lib/googleauth/version.rb +11 -26
- data/lib/googleauth/web_user_authorizer.rb +14 -32
- data/lib/googleauth.rb +10 -25
- metadata +26 -97
- data/.github/CODEOWNERS +0 -7
- data/.github/CONTRIBUTING.md +0 -74
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -36
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -21
- data/.github/ISSUE_TEMPLATE/support_request.md +0 -7
- data/.gitignore +0 -36
- data/.kokoro/build.bat +0 -16
- data/.kokoro/build.sh +0 -4
- data/.kokoro/continuous/common.cfg +0 -24
- data/.kokoro/continuous/linux.cfg +0 -25
- data/.kokoro/continuous/osx.cfg +0 -8
- data/.kokoro/continuous/post.cfg +0 -30
- data/.kokoro/continuous/windows.cfg +0 -29
- data/.kokoro/osx.sh +0 -4
- data/.kokoro/presubmit/common.cfg +0 -24
- data/.kokoro/presubmit/linux.cfg +0 -24
- data/.kokoro/presubmit/osx.cfg +0 -8
- data/.kokoro/presubmit/windows.cfg +0 -29
- data/.kokoro/release.cfg +0 -94
- data/.kokoro/trampoline.bat +0 -10
- data/.kokoro/trampoline.sh +0 -4
- data/.repo-metadata.json +0 -5
- data/.rspec +0 -2
- data/.rubocop.yml +0 -19
- data/Gemfile +0 -30
- data/Rakefile +0 -132
- data/googleauth.gemspec +0 -38
- data/integration/helper.rb +0 -31
- data/integration/id_tokens/key_source_test.rb +0 -74
- data/rakelib/devsite_builder.rb +0 -45
- data/rakelib/link_checker.rb +0 -64
- data/rakelib/repo_metadata.rb +0 -59
- data/spec/googleauth/apply_auth_examples.rb +0 -171
- data/spec/googleauth/client_id_spec.rb +0 -160
- data/spec/googleauth/compute_engine_spec.rb +0 -160
- data/spec/googleauth/credentials_spec.rb +0 -478
- data/spec/googleauth/get_application_default_spec.rb +0 -286
- data/spec/googleauth/iam_spec.rb +0 -80
- data/spec/googleauth/scope_util_spec.rb +0 -77
- data/spec/googleauth/service_account_spec.rb +0 -489
- data/spec/googleauth/signet_spec.rb +0 -142
- data/spec/googleauth/stores/file_token_store_spec.rb +0 -57
- data/spec/googleauth/stores/redis_token_store_spec.rb +0 -50
- data/spec/googleauth/stores/store_examples.rb +0 -58
- data/spec/googleauth/user_authorizer_spec.rb +0 -343
- data/spec/googleauth/user_refresh_spec.rb +0 -359
- data/spec/googleauth/web_user_authorizer_spec.rb +0 -172
- data/spec/spec_helper.rb +0 -92
- data/test/helper.rb +0 -33
- data/test/id_tokens/key_sources_test.rb +0 -240
- data/test/id_tokens/verifier_test.rb +0 -269
@@ -1,31 +1,16 @@
|
|
1
|
-
# Copyright 2014
|
2
|
-
# All rights reserved.
|
1
|
+
# Copyright 2014 Google, Inc.
|
3
2
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
7
6
|
#
|
8
|
-
#
|
9
|
-
# notice, this list of conditions and the following disclaimer.
|
10
|
-
# * Redistributions in binary form must reproduce the above
|
11
|
-
# copyright notice, this list of conditions and the following disclaimer
|
12
|
-
# in the documentation and/or other materials provided with the
|
13
|
-
# distribution.
|
14
|
-
# * Neither the name of Google Inc. nor the names of its
|
15
|
-
# contributors may be used to endorse or promote products derived from
|
16
|
-
# this software without specific prior written permission.
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
17
8
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
-
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
29
14
|
|
30
15
|
require "yaml/store"
|
31
16
|
require "googleauth/token_store"
|
@@ -40,6 +25,7 @@ module Google
|
|
40
25
|
# @param [String, File] file
|
41
26
|
# Path to storage file
|
42
27
|
def initialize options = {}
|
28
|
+
super()
|
43
29
|
path = options[:file]
|
44
30
|
@store = YAML::Store.new path
|
45
31
|
end
|
@@ -1,31 +1,16 @@
|
|
1
|
-
# Copyright 2014
|
2
|
-
# All rights reserved.
|
1
|
+
# Copyright 2014 Google, Inc.
|
3
2
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
7
6
|
#
|
8
|
-
#
|
9
|
-
# notice, this list of conditions and the following disclaimer.
|
10
|
-
# * Redistributions in binary form must reproduce the above
|
11
|
-
# copyright notice, this list of conditions and the following disclaimer
|
12
|
-
# in the documentation and/or other materials provided with the
|
13
|
-
# distribution.
|
14
|
-
# * Neither the name of Google Inc. nor the names of its
|
15
|
-
# contributors may be used to endorse or promote products derived from
|
16
|
-
# this software without specific prior written permission.
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
17
8
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
-
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
29
14
|
|
30
15
|
require "redis"
|
31
16
|
require "googleauth/token_store"
|
@@ -49,6 +34,7 @@ module Google
|
|
49
34
|
# the options passed through. You may include any other keys accepted
|
50
35
|
# by `Redis.new`
|
51
36
|
def initialize options = {}
|
37
|
+
super()
|
52
38
|
redis = options.delete :redis
|
53
39
|
prefix = options.delete :prefix
|
54
40
|
@redis = case redis
|
@@ -1,31 +1,16 @@
|
|
1
|
-
# Copyright 2014
|
2
|
-
# All rights reserved.
|
1
|
+
# Copyright 2014 Google, Inc.
|
3
2
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
7
6
|
#
|
8
|
-
#
|
9
|
-
# notice, this list of conditions and the following disclaimer.
|
10
|
-
# * Redistributions in binary form must reproduce the above
|
11
|
-
# copyright notice, this list of conditions and the following disclaimer
|
12
|
-
# in the documentation and/or other materials provided with the
|
13
|
-
# distribution.
|
14
|
-
# * Neither the name of Google Inc. nor the names of its
|
15
|
-
# contributors may be used to endorse or promote products derived from
|
16
|
-
# this software without specific prior written permission.
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
17
8
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
-
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
29
14
|
|
30
15
|
module Google
|
31
16
|
module Auth
|
@@ -1,31 +1,16 @@
|
|
1
|
-
# Copyright 2014
|
2
|
-
# All rights reserved.
|
1
|
+
# Copyright 2014 Google, Inc.
|
3
2
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
7
6
|
#
|
8
|
-
#
|
9
|
-
# notice, this list of conditions and the following disclaimer.
|
10
|
-
# * Redistributions in binary form must reproduce the above
|
11
|
-
# copyright notice, this list of conditions and the following disclaimer
|
12
|
-
# in the documentation and/or other materials provided with the
|
13
|
-
# distribution.
|
14
|
-
# * Neither the name of Google Inc. nor the names of its
|
15
|
-
# contributors may be used to endorse or promote products derived from
|
16
|
-
# this software without specific prior written permission.
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
17
8
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
-
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
29
14
|
|
30
15
|
require "uri"
|
31
16
|
require "multi_json"
|
@@ -1,31 +1,16 @@
|
|
1
|
-
# Copyright 2015
|
2
|
-
# All rights reserved.
|
1
|
+
# Copyright 2015 Google, Inc.
|
3
2
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
7
6
|
#
|
8
|
-
#
|
9
|
-
# notice, this list of conditions and the following disclaimer.
|
10
|
-
# * Redistributions in binary form must reproduce the above
|
11
|
-
# copyright notice, this list of conditions and the following disclaimer
|
12
|
-
# in the documentation and/or other materials provided with the
|
13
|
-
# distribution.
|
14
|
-
# * Neither the name of Google Inc. nor the names of its
|
15
|
-
# contributors may be used to endorse or promote products derived from
|
16
|
-
# this software without specific prior written permission.
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
17
8
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
-
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
29
14
|
|
30
15
|
require "googleauth/signet"
|
31
16
|
require "googleauth/credentials_loader"
|
@@ -51,6 +36,7 @@ module Google
|
|
51
36
|
REVOKE_TOKEN_URI = "https://oauth2.googleapis.com/revoke".freeze
|
52
37
|
extend CredentialsLoader
|
53
38
|
attr_reader :project_id
|
39
|
+
attr_reader :quota_project_id
|
54
40
|
|
55
41
|
# Create a UserRefreshCredentials.
|
56
42
|
#
|
@@ -63,14 +49,15 @@ module Google
|
|
63
49
|
"client_id" => ENV[CredentialsLoader::CLIENT_ID_VAR],
|
64
50
|
"client_secret" => ENV[CredentialsLoader::CLIENT_SECRET_VAR],
|
65
51
|
"refresh_token" => ENV[CredentialsLoader::REFRESH_TOKEN_VAR],
|
66
|
-
"project_id" => ENV[CredentialsLoader::PROJECT_ID_VAR]
|
52
|
+
"project_id" => ENV[CredentialsLoader::PROJECT_ID_VAR],
|
53
|
+
"quota_project_id" => nil
|
67
54
|
}
|
68
|
-
|
69
55
|
new(token_credential_uri: TOKEN_CRED_URI,
|
70
56
|
client_id: user_creds["client_id"],
|
71
57
|
client_secret: user_creds["client_secret"],
|
72
58
|
refresh_token: user_creds["refresh_token"],
|
73
59
|
project_id: user_creds["project_id"],
|
60
|
+
quota_project_id: user_creds["quota_project_id"],
|
74
61
|
scope: scope)
|
75
62
|
.configure_connection(options)
|
76
63
|
end
|
@@ -92,6 +79,7 @@ module Google
|
|
92
79
|
options[:authorization_uri] ||= AUTHORIZATION_URI
|
93
80
|
@project_id = options[:project_id]
|
94
81
|
@project_id ||= CredentialsLoader.load_gcloud_project_id
|
82
|
+
@quota_project_id = options[:quota_project_id]
|
95
83
|
super options
|
96
84
|
end
|
97
85
|
|
data/lib/googleauth/version.rb
CHANGED
@@ -1,36 +1,21 @@
|
|
1
|
-
# Copyright 2014
|
2
|
-
# All rights reserved.
|
1
|
+
# Copyright 2014 Google, Inc.
|
3
2
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
7
6
|
#
|
8
|
-
#
|
9
|
-
# notice, this list of conditions and the following disclaimer.
|
10
|
-
# * Redistributions in binary form must reproduce the above
|
11
|
-
# copyright notice, this list of conditions and the following disclaimer
|
12
|
-
# in the documentation and/or other materials provided with the
|
13
|
-
# distribution.
|
14
|
-
# * Neither the name of Google Inc. nor the names of its
|
15
|
-
# contributors may be used to endorse or promote products derived from
|
16
|
-
# this software without specific prior written permission.
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
17
8
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
-
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
29
14
|
|
30
15
|
module Google
|
31
16
|
# Module Auth provides classes that provide Google-specific authorization
|
32
17
|
# used to access Google APIs.
|
33
18
|
module Auth
|
34
|
-
VERSION = "
|
19
|
+
VERSION = "1.3.0".freeze
|
35
20
|
end
|
36
21
|
end
|
@@ -1,31 +1,16 @@
|
|
1
|
-
# Copyright 2014
|
2
|
-
# All rights reserved.
|
1
|
+
# Copyright 2014 Google, Inc.
|
3
2
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
7
6
|
#
|
8
|
-
#
|
9
|
-
# notice, this list of conditions and the following disclaimer.
|
10
|
-
# * Redistributions in binary form must reproduce the above
|
11
|
-
# copyright notice, this list of conditions and the following disclaimer
|
12
|
-
# in the documentation and/or other materials provided with the
|
13
|
-
# distribution.
|
14
|
-
# * Neither the name of Google Inc. nor the names of its
|
15
|
-
# contributors may be used to endorse or promote products derived from
|
16
|
-
# this software without specific prior written permission.
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
17
8
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
-
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
29
14
|
|
30
15
|
require "multi_json"
|
31
16
|
require "googleauth/signet"
|
@@ -58,12 +43,9 @@ module Google
|
|
58
43
|
# end
|
59
44
|
#
|
60
45
|
# Instead of implementing the callback directly, applications are
|
61
|
-
# encouraged to use {Google::Auth::
|
46
|
+
# encouraged to use {Google::Auth::WebUserAuthorizer::CallbackApp} instead.
|
62
47
|
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
# @see {Google::Auth::AuthCallbackApp}
|
66
|
-
# @see {Google::Auth::ControllerHelpers}
|
48
|
+
# @see CallbackApp
|
67
49
|
# @note Requires sessions are enabled
|
68
50
|
class WebUserAuthorizer < Google::Auth::UserAuthorizer
|
69
51
|
STATE_PARAM = "state".freeze
|
@@ -192,7 +174,7 @@ module Google
|
|
192
174
|
# May raise an error if an authorization code is present in the session
|
193
175
|
# and exchange of the code fails
|
194
176
|
def get_credentials user_id, request = nil, scope = nil
|
195
|
-
if request
|
177
|
+
if request&.session&.key? CALLBACK_STATE_KEY
|
196
178
|
# Note - in theory, no need to check required scope as this is
|
197
179
|
# expected to be called immediately after a return from authorization
|
198
180
|
state_json = request.session.delete CALLBACK_STATE_KEY
|
@@ -261,7 +243,7 @@ module Google
|
|
261
243
|
# Google::Auth::WebUserAuthorizer::CallbackApp.call(env)
|
262
244
|
# end
|
263
245
|
#
|
264
|
-
# @see
|
246
|
+
# @see Google::Auth::WebUserAuthorizer
|
265
247
|
class CallbackApp
|
266
248
|
LOCATION_HEADER = "Location".freeze
|
267
249
|
REDIR_STATUS = 302
|
data/lib/googleauth.rb
CHANGED
@@ -1,31 +1,16 @@
|
|
1
|
-
# Copyright 2015
|
2
|
-
# All rights reserved.
|
1
|
+
# Copyright 2015 Google, Inc.
|
3
2
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
7
6
|
#
|
8
|
-
#
|
9
|
-
# notice, this list of conditions and the following disclaimer.
|
10
|
-
# * Redistributions in binary form must reproduce the above
|
11
|
-
# copyright notice, this list of conditions and the following disclaimer
|
12
|
-
# in the documentation and/or other materials provided with the
|
13
|
-
# distribution.
|
14
|
-
# * Neither the name of Google Inc. nor the names of its
|
15
|
-
# contributors may be used to endorse or promote products derived from
|
16
|
-
# this software without specific prior written permission.
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
17
8
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
24
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
26
|
-
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
27
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
29
14
|
|
30
15
|
require "googleauth/application_default"
|
31
16
|
require "googleauth/client_id"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googleauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Emiola
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 0.17.3
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 3.a
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 0.17.3
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 3.a
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: jwt
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,72 +102,36 @@ dependencies:
|
|
102
102
|
name: signet
|
103
103
|
requirement: !ruby/object:Gem::Requirement
|
104
104
|
requirements:
|
105
|
-
- - "
|
105
|
+
- - ">="
|
106
106
|
- !ruby/object:Gem::Version
|
107
|
-
version: '0.
|
107
|
+
version: '0.16'
|
108
|
+
- - "<"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.a
|
108
111
|
type: :runtime
|
109
112
|
prerelease: false
|
110
113
|
version_requirements: !ruby/object:Gem::Requirement
|
111
114
|
requirements:
|
112
|
-
- - "
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
version: '0.14'
|
115
|
-
- !ruby/object:Gem::Dependency
|
116
|
-
name: yard
|
117
|
-
requirement: !ruby/object:Gem::Requirement
|
118
|
-
requirements:
|
119
|
-
- - "~>"
|
115
|
+
- - ">="
|
120
116
|
- !ruby/object:Gem::Version
|
121
|
-
version: '0.
|
122
|
-
|
123
|
-
prerelease: false
|
124
|
-
version_requirements: !ruby/object:Gem::Requirement
|
125
|
-
requirements:
|
126
|
-
- - "~>"
|
117
|
+
version: '0.16'
|
118
|
+
- - "<"
|
127
119
|
- !ruby/object:Gem::Version
|
128
|
-
version:
|
129
|
-
description:
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
email: temiola@google.com
|
120
|
+
version: 2.a
|
121
|
+
description: Implements simple authorization for accessing Google APIs, and provides
|
122
|
+
support for Application Default Credentials.
|
123
|
+
email:
|
124
|
+
- temiola@google.com
|
134
125
|
executables: []
|
135
126
|
extensions: []
|
136
127
|
extra_rdoc_files: []
|
137
128
|
files:
|
138
|
-
- ".
|
139
|
-
- ".github/CONTRIBUTING.md"
|
140
|
-
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
141
|
-
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
142
|
-
- ".github/ISSUE_TEMPLATE/support_request.md"
|
143
|
-
- ".gitignore"
|
144
|
-
- ".kokoro/build.bat"
|
145
|
-
- ".kokoro/build.sh"
|
146
|
-
- ".kokoro/continuous/common.cfg"
|
147
|
-
- ".kokoro/continuous/linux.cfg"
|
148
|
-
- ".kokoro/continuous/osx.cfg"
|
149
|
-
- ".kokoro/continuous/post.cfg"
|
150
|
-
- ".kokoro/continuous/windows.cfg"
|
151
|
-
- ".kokoro/osx.sh"
|
152
|
-
- ".kokoro/presubmit/common.cfg"
|
153
|
-
- ".kokoro/presubmit/linux.cfg"
|
154
|
-
- ".kokoro/presubmit/osx.cfg"
|
155
|
-
- ".kokoro/presubmit/windows.cfg"
|
156
|
-
- ".kokoro/release.cfg"
|
157
|
-
- ".kokoro/trampoline.bat"
|
158
|
-
- ".kokoro/trampoline.sh"
|
159
|
-
- ".repo-metadata.json"
|
160
|
-
- ".rspec"
|
161
|
-
- ".rubocop.yml"
|
129
|
+
- ".yardopts"
|
162
130
|
- CHANGELOG.md
|
163
131
|
- CODE_OF_CONDUCT.md
|
164
|
-
- Gemfile
|
165
132
|
- LICENSE
|
166
133
|
- README.md
|
167
|
-
-
|
168
|
-
- googleauth.gemspec
|
169
|
-
- integration/helper.rb
|
170
|
-
- integration/id_tokens/key_source_test.rb
|
134
|
+
- SECURITY.md
|
171
135
|
- lib/googleauth.rb
|
172
136
|
- lib/googleauth/application_default.rb
|
173
137
|
- lib/googleauth/client_id.rb
|
@@ -191,32 +155,13 @@ files:
|
|
191
155
|
- lib/googleauth/user_refresh.rb
|
192
156
|
- lib/googleauth/version.rb
|
193
157
|
- lib/googleauth/web_user_authorizer.rb
|
194
|
-
- rakelib/devsite_builder.rb
|
195
|
-
- rakelib/link_checker.rb
|
196
|
-
- rakelib/repo_metadata.rb
|
197
|
-
- spec/googleauth/apply_auth_examples.rb
|
198
|
-
- spec/googleauth/client_id_spec.rb
|
199
|
-
- spec/googleauth/compute_engine_spec.rb
|
200
|
-
- spec/googleauth/credentials_spec.rb
|
201
|
-
- spec/googleauth/get_application_default_spec.rb
|
202
|
-
- spec/googleauth/iam_spec.rb
|
203
|
-
- spec/googleauth/scope_util_spec.rb
|
204
|
-
- spec/googleauth/service_account_spec.rb
|
205
|
-
- spec/googleauth/signet_spec.rb
|
206
|
-
- spec/googleauth/stores/file_token_store_spec.rb
|
207
|
-
- spec/googleauth/stores/redis_token_store_spec.rb
|
208
|
-
- spec/googleauth/stores/store_examples.rb
|
209
|
-
- spec/googleauth/user_authorizer_spec.rb
|
210
|
-
- spec/googleauth/user_refresh_spec.rb
|
211
|
-
- spec/googleauth/web_user_authorizer_spec.rb
|
212
|
-
- spec/spec_helper.rb
|
213
|
-
- test/helper.rb
|
214
|
-
- test/id_tokens/key_sources_test.rb
|
215
|
-
- test/id_tokens/verifier_test.rb
|
216
158
|
homepage: https://github.com/googleapis/google-auth-library-ruby
|
217
159
|
licenses:
|
218
160
|
- Apache-2.0
|
219
|
-
metadata:
|
161
|
+
metadata:
|
162
|
+
changelog_uri: https://github.com/googleapis/google-auth-library-ruby/blob/main/CHANGELOG.md
|
163
|
+
source_code_uri: https://github.com/googleapis/google-auth-library-ruby
|
164
|
+
bug_tracker_uri: https://github.com/googleapis/google-auth-library-ruby/issues
|
220
165
|
post_install_message:
|
221
166
|
rdoc_options: []
|
222
167
|
require_paths:
|
@@ -225,31 +170,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
170
|
requirements:
|
226
171
|
- - ">="
|
227
172
|
- !ruby/object:Gem::Version
|
228
|
-
version: 2.
|
173
|
+
version: '2.6'
|
229
174
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
175
|
requirements:
|
231
176
|
- - ">="
|
232
177
|
- !ruby/object:Gem::Version
|
233
178
|
version: '0'
|
234
179
|
requirements: []
|
235
|
-
rubygems_version: 3.
|
180
|
+
rubygems_version: 3.3.14
|
236
181
|
signing_key:
|
237
182
|
specification_version: 4
|
238
183
|
summary: Google Auth Library for Ruby
|
239
|
-
test_files:
|
240
|
-
- spec/googleauth/apply_auth_examples.rb
|
241
|
-
- spec/googleauth/client_id_spec.rb
|
242
|
-
- spec/googleauth/compute_engine_spec.rb
|
243
|
-
- spec/googleauth/credentials_spec.rb
|
244
|
-
- spec/googleauth/get_application_default_spec.rb
|
245
|
-
- spec/googleauth/iam_spec.rb
|
246
|
-
- spec/googleauth/scope_util_spec.rb
|
247
|
-
- spec/googleauth/service_account_spec.rb
|
248
|
-
- spec/googleauth/signet_spec.rb
|
249
|
-
- spec/googleauth/stores/file_token_store_spec.rb
|
250
|
-
- spec/googleauth/stores/redis_token_store_spec.rb
|
251
|
-
- spec/googleauth/stores/store_examples.rb
|
252
|
-
- spec/googleauth/user_authorizer_spec.rb
|
253
|
-
- spec/googleauth/user_refresh_spec.rb
|
254
|
-
- spec/googleauth/web_user_authorizer_spec.rb
|
255
|
-
- spec/spec_helper.rb
|
184
|
+
test_files: []
|
data/.github/CODEOWNERS
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# Code owners file.
|
2
|
-
# This file controls who is tagged for review for any given pull request.
|
3
|
-
#
|
4
|
-
# For syntax help see:
|
5
|
-
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
|
6
|
-
|
7
|
-
* @googleapis/yoshi-ruby
|