microsoft_kiota_authentication_oauth 0.6.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -1
- data/.github/workflows/auto-merge-dependabot.yml +32 -0
- data/.github/workflows/projectsbot.yml +1 -1
- data/.github/workflows/release.yml +1 -1
- data/.github/workflows/ruby.yml +2 -2
- data/CHANGELOG.md +14 -0
- data/README.md +2 -2
- data/lib/microsoft_kiota_authentication_oauth/contexts/client_credential_context.rb +2 -4
- data/lib/microsoft_kiota_authentication_oauth/oauth_access_token_provider.rb +19 -9
- data/lib/microsoft_kiota_authentication_oauth/version.rb +1 -1
- data/microsoft_kiota_authentication_oauth.gemspec +3 -3
- metadata +10 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f62df65c21976f6c761f82bcec62fe603d36a139c19db481c7e23b1c90d47524
|
4
|
+
data.tar.gz: d6525e628ef7a822cceefd9b83c0dc66d7830a3245f9226a0fa53fa924337b8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f68aca9abc1f4b337b16f2171a238c896e29187c779b3cdb7598150de55e988fdaa47fc56756d0574664355c3a68686b9ce1f3d3ac48ffc2fb22ce5d653f64e4
|
7
|
+
data.tar.gz: 7c38d9c15ad533372599c2fe8a77b056451ec869c5b9ffbca7bd8743d118f469b4f8ed328bdc51f3174026b844160fc0f0fe954d1ecf5645adb363ab665ea186
|
data/.github/CODEOWNERS
CHANGED
@@ -1 +1 @@
|
|
1
|
-
* @andrueastman @baywet @
|
1
|
+
* @andrueastman @baywet @zengin @MichaelMainer @peombwa @calebkiage @Ndiritu @rkodev
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Auto-merge dependabot updates
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches: [ main ]
|
6
|
+
|
7
|
+
permissions:
|
8
|
+
pull-requests: write
|
9
|
+
contents: write
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
|
13
|
+
dependabot-merge:
|
14
|
+
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
|
17
|
+
if: ${{ github.actor == 'dependabot[bot]' }}
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- name: Dependabot metadata
|
21
|
+
id: metadata
|
22
|
+
uses: dependabot/fetch-metadata@v1.3.6
|
23
|
+
with:
|
24
|
+
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
25
|
+
|
26
|
+
- name: Enable auto-merge for Dependabot PRs
|
27
|
+
# Only if version bump is not a major version change
|
28
|
+
if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}}
|
29
|
+
run: gh pr merge --auto --merge "$PR_URL"
|
30
|
+
env:
|
31
|
+
PR_URL: ${{github.event.pull_request.html_url}}
|
32
|
+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
@@ -10,7 +10,7 @@ jobs:
|
|
10
10
|
steps:
|
11
11
|
- name: Generate token
|
12
12
|
id: generate_token
|
13
|
-
uses: tibdex/github-app-token@
|
13
|
+
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
|
14
14
|
with:
|
15
15
|
app_id: ${{ secrets.GRAPHBOT_APP_ID }}
|
16
16
|
private_key: ${{ secrets.GRAPHBOT_APP_PEM }}
|
data/.github/workflows/ruby.yml
CHANGED
@@ -12,7 +12,7 @@ jobs:
|
|
12
12
|
fail-fast: false
|
13
13
|
matrix:
|
14
14
|
os: [ubuntu-latest, macos-latest]
|
15
|
-
ruby-version: ['
|
15
|
+
ruby-version: ['3.0', '3.1', '3.2', head, jruby, jruby-head, truffleruby, truffleruby-head]
|
16
16
|
runs-on: ${{ matrix.os }}
|
17
17
|
steps:
|
18
18
|
- uses: actions/checkout@v3
|
@@ -25,7 +25,7 @@ jobs:
|
|
25
25
|
- name: Run tests
|
26
26
|
run: bundle exec rake
|
27
27
|
- name: Upload artifacts for ruby version 3 and ubuntu
|
28
|
-
if: ${{ matrix.os == 'ubuntu-latest' && matrix.ruby-version == '3.
|
28
|
+
if: ${{ matrix.os == 'ubuntu-latest' && matrix.ruby-version == '3.2'}}
|
29
29
|
uses: actions/upload-artifact@v3
|
30
30
|
with:
|
31
31
|
name: drop
|
data/CHANGELOG.md
CHANGED
@@ -11,6 +11,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
11
11
|
|
12
12
|
### Changed
|
13
13
|
|
14
|
+
## [0.8.0] - 2023-03-28
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
|
18
|
+
- Updated kiota abstractions reference
|
19
|
+
- Bumped minimum required ruby version to 3.0.
|
20
|
+
|
21
|
+
## [0.7.0] - 2023-01-17
|
22
|
+
|
23
|
+
### Changed
|
24
|
+
|
25
|
+
- Removed Microsoft Graph specific defaults.
|
26
|
+
- Fixed an issue where the access token provider would fail on return.
|
27
|
+
|
14
28
|
## [0.6.0] - 2023-01-16
|
15
29
|
|
16
30
|
### Changed
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ Read more about Kiota [here](https://github.com/microsoft/kiota/blob/main/README
|
|
15
15
|
Add this line to your application's Gemfile:
|
16
16
|
|
17
17
|
```ruby
|
18
|
-
gem "microsoft_kiota_authentication_oauth", "0.
|
18
|
+
gem "microsoft_kiota_authentication_oauth", "0.6.0"
|
19
19
|
```
|
20
20
|
|
21
21
|
And then execute:
|
@@ -27,7 +27,7 @@ bundle install
|
|
27
27
|
Or install it yourself as:
|
28
28
|
|
29
29
|
```shell
|
30
|
-
gem install microsoft_kiota_authentication_oauth --version "0.
|
30
|
+
gem install microsoft_kiota_authentication_oauth --version "0.6.0"
|
31
31
|
```
|
32
32
|
|
33
33
|
## Contributing
|
@@ -44,11 +44,9 @@ module MicrosoftKiotaAuthenticationOAuth
|
|
44
44
|
end
|
45
45
|
|
46
46
|
# Function to initialize the scope for the client credential context object.
|
47
|
-
#
|
48
|
-
# for this flow.
|
47
|
+
# Only a single scope is supported for this flow and it's expected to be schme://service/.default
|
49
48
|
def initialize_scopes(scopes = [])
|
50
|
-
|
51
|
-
@scopes = scope_str
|
49
|
+
@scopes = scopes[0] unless scopes.empty?
|
52
50
|
end
|
53
51
|
|
54
52
|
|
@@ -29,14 +29,16 @@ module MicrosoftKiotaAuthenticationOAuth
|
|
29
29
|
@cached_token = nil
|
30
30
|
|
31
31
|
@host_validator = if allowed_hosts.nil? || allowed_hosts.size.zero?
|
32
|
-
MicrosoftKiotaAbstractions::AllowedHostsValidator.new([
|
33
|
-
'graph.microsoft.de', 'microsoftgraph.chinacloudapi.cn',
|
34
|
-
'canary.graph.microsoft.com'])
|
32
|
+
MicrosoftKiotaAbstractions::AllowedHostsValidator.new([])
|
35
33
|
else
|
36
34
|
MicrosoftKiotaAbstractions::AllowedHostsValidator.new(allowed_hosts)
|
37
35
|
end
|
38
36
|
@token_request_context.initialize_oauth_provider
|
39
|
-
|
37
|
+
if scopes.nil?
|
38
|
+
@scopes = []
|
39
|
+
else
|
40
|
+
@scopes = scopes
|
41
|
+
end
|
40
42
|
end
|
41
43
|
|
42
44
|
# This function obtains the authorization token.
|
@@ -45,29 +47,37 @@ module MicrosoftKiotaAuthenticationOAuth
|
|
45
47
|
# additional_params: hash of symbols to string values, ie { response_mode: 'fragment', prompt: 'login' }
|
46
48
|
# default is empty hash
|
47
49
|
def get_authorization_token(uri, additional_properties = {})
|
48
|
-
|
50
|
+
nil if !uri || !@host_validator.url_host_valid?(uri)
|
49
51
|
|
50
52
|
parsed_url = URI(uri)
|
51
53
|
|
52
54
|
raise StandardError, 'Only https is supported' if parsed_url.scheme != 'https'
|
53
55
|
|
56
|
+
if @scopes.empty?
|
57
|
+
@scopes << "#{parsed_url.scheme}://#{parsed_url.host}/.default"
|
58
|
+
end
|
59
|
+
@token_request_context.initialize_scopes(@scopes)
|
54
60
|
Fiber.new do
|
55
61
|
if @cached_token
|
56
62
|
token = OAuth2::AccessToken.from_hash(@token_request_context.oauth_provider, @cached_token)
|
57
|
-
|
63
|
+
token.token unless token.nil? || token.expired?
|
58
64
|
|
59
65
|
if token.expired?
|
60
66
|
token = token.refresh!
|
61
67
|
@cached_token = token.to_hash
|
62
|
-
|
68
|
+
token.token
|
63
69
|
end
|
64
70
|
end
|
65
71
|
|
66
72
|
token = nil
|
67
73
|
token = @token_request_context.get_token
|
68
74
|
|
69
|
-
|
70
|
-
|
75
|
+
if !token.nil?
|
76
|
+
@cached_token = token.to_hash
|
77
|
+
token.token
|
78
|
+
else
|
79
|
+
nil
|
80
|
+
end
|
71
81
|
end
|
72
82
|
end
|
73
83
|
|
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "microsoft_kiota_authentication_oauth"
|
7
7
|
spec.version = MicrosoftKiotaAuthenticationOAuth::VERSION
|
8
8
|
spec.authors = 'Microsoft Corporation'
|
9
|
-
spec.email = 'graphsdkpub@microsoft.com'
|
9
|
+
spec.email = 'graphsdkpub+ruby@microsoft.com'
|
10
10
|
spec.description = 'Kiota Authentication implementation with oauth2'
|
11
11
|
spec.summary = 'Microsoft Kiota Authentication OAuth - Kiota Ruby Authentication OAuth library'
|
12
12
|
spec.homepage = 'https://microsoft.github.io/kiota/'
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
'source_code_uri' => 'https://github.com/microsoft/kiota-authentication-oauth-ruby',
|
19
19
|
'github_repo' => 'ssh://github.com/microsoft/kiota-authentication-oauth-ruby'
|
20
20
|
}
|
21
|
-
spec.required_ruby_version = ">=
|
21
|
+
spec.required_ruby_version = ">= 3.0.0"
|
22
22
|
|
23
23
|
# Specify which files should be added to the gem when it is released.
|
24
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ['lib']
|
32
32
|
|
33
|
-
spec.add_runtime_dependency 'microsoft_kiota_abstractions', '
|
33
|
+
spec.add_runtime_dependency 'microsoft_kiota_abstractions', '~> 0.14.0'
|
34
34
|
spec.add_runtime_dependency 'oauth2', '~> 2.0'
|
35
35
|
spec.add_development_dependency 'rake', '~> 13.0'
|
36
36
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
metadata
CHANGED
@@ -1,35 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: microsoft_kiota_authentication_oauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: microsoft_kiota_abstractions
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.12'
|
20
|
-
- - "<"
|
17
|
+
- - "~>"
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
19
|
+
version: 0.14.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- - "
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0.12'
|
30
|
-
- - "<"
|
24
|
+
- - "~>"
|
31
25
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
26
|
+
version: 0.14.0
|
33
27
|
- !ruby/object:Gem::Dependency
|
34
28
|
name: oauth2
|
35
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,13 +81,14 @@ dependencies:
|
|
87
81
|
- !ruby/object:Gem::Version
|
88
82
|
version: '0'
|
89
83
|
description: Kiota Authentication implementation with oauth2
|
90
|
-
email: graphsdkpub@microsoft.com
|
84
|
+
email: graphsdkpub+ruby@microsoft.com
|
91
85
|
executables: []
|
92
86
|
extensions: []
|
93
87
|
extra_rdoc_files: []
|
94
88
|
files:
|
95
89
|
- ".github/CODEOWNERS"
|
96
90
|
- ".github/dependabot.yml"
|
91
|
+
- ".github/workflows/auto-merge-dependabot.yml"
|
97
92
|
- ".github/workflows/code-ql.yml"
|
98
93
|
- ".github/workflows/conflicting-pr-label.yml"
|
99
94
|
- ".github/workflows/projectsbot.yml"
|
@@ -136,14 +131,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
131
|
requirements:
|
137
132
|
- - ">="
|
138
133
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
134
|
+
version: 3.0.0
|
140
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
136
|
requirements:
|
142
137
|
- - ">="
|
143
138
|
- !ruby/object:Gem::Version
|
144
139
|
version: '0'
|
145
140
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
141
|
+
rubygems_version: 3.4.6
|
147
142
|
signing_key:
|
148
143
|
specification_version: 4
|
149
144
|
summary: Microsoft Kiota Authentication OAuth - Kiota Ruby Authentication OAuth library
|