microsoft_kiota_authentication_oauth 0.6.0 → 0.8.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f49ff1a865cc86dc2ebd9a925d5ba9ac014c1e1b83515914d3a6baf92ea5f7f
4
- data.tar.gz: e0add8d9df6e81895e77493e7125b84604a6a021c269315076fe1b0cc7e5a416
3
+ metadata.gz: f62df65c21976f6c761f82bcec62fe603d36a139c19db481c7e23b1c90d47524
4
+ data.tar.gz: d6525e628ef7a822cceefd9b83c0dc66d7830a3245f9226a0fa53fa924337b8e
5
5
  SHA512:
6
- metadata.gz: 5f44f1eb63e0b13b7454fde399ed6a52a87c569c456c7ff598d1cc62698904c159633d79bc0a3fe2c721348ff6498afc54c3f0dcfd834cbc2c5e878cfcaaf9be
7
- data.tar.gz: 4a9ce2aa365181f4c90d805338b6b53f7f63f2aeee54e05e44cf308adc64790b3ecd3817c8f86c8f88dd733f7e60319456e54e45d0fcd3048b351922ace6cb2a
6
+ metadata.gz: f68aca9abc1f4b337b16f2171a238c896e29187c779b3cdb7598150de55e988fdaa47fc56756d0574664355c3a68686b9ce1f3d3ac48ffc2fb22ce5d653f64e4
7
+ data.tar.gz: 7c38d9c15ad533372599c2fe8a77b056451ec869c5b9ffbca7bd8743d118f469b4f8ed328bdc51f3174026b844160fc0f0fe954d1ecf5645adb363ab665ea186
data/.github/CODEOWNERS CHANGED
@@ -1 +1 @@
1
- * @andrueastman @baywet @darrelmiller @zengin @MichaelMainer @ddyett @peombwa @nikithauc @ramsessanchez @calebkiage @Ndiritu @rkodev @gavinbarron
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@021a2405c7f990db57f5eae5397423dcc554159c
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 }}
@@ -28,7 +28,7 @@ jobs:
28
28
  - uses: actions/checkout@v3
29
29
  - uses: ruby/setup-ruby@v1
30
30
  with:
31
- ruby-version: '3.1'
31
+ ruby-version: '3.2'
32
32
  bundler-cache: true # runs 'bundle install' and caches installed gems automatically
33
33
  bundler: 'latest'
34
34
  cache-version: 1
@@ -12,7 +12,7 @@ jobs:
12
12
  fail-fast: false
13
13
  matrix:
14
14
  os: [ubuntu-latest, macos-latest]
15
- ruby-version: ['2.7', '3.0', '3.1', head, jruby, jruby-head, truffleruby, truffleruby-head]
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.1'}}
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.5.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.5.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
- # This function forces to default since gradual consent is not supported
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
- scope_str = 'https://graph.microsoft.com/.default'
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(['graph.microsoft.com', 'graph.microsoft.us', 'dod-graph.microsoft.us',
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
- @token_request_context.initialize_scopes(scopes)
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
- return nil if !uri || !@host_validator.url_host_valid?(uri)
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
- return token.token if !token.nil? && !token.expired?
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
- return token.token
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
- @cached_token = token.to_hash unless token.nil?
70
- return token.token unless token.nil?
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MicrosoftKiotaAuthenticationOAuth
4
- VERSION = "0.6.0"
4
+ VERSION = "0.8.0"
5
5
  end
@@ -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 = ">= 2.7.0"
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', '>= 0.12', '< 0.14'
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.6.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-01-16 00:00:00.000000000 Z
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: '0.14'
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: '0.14'
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: 2.7.0
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.3.26
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