omniauth-pagerduty 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe2dc85dab1301ca82296b54aec38b4a0d6d6e29970769a6e341d6e2469f3b37
4
- data.tar.gz: c3bb1c303e57a3dca735daee720dfbe9b8979beee928bef67dd20ceb7ea0e859
3
+ metadata.gz: 375ec937ffed26c1d1b993f31408aa944f269bd6864bc1628c4a5b7c0da20249
4
+ data.tar.gz: 3a7351de98716415128707c2b41c35f8d441fe8d8782b84b99aa22589069b3ee
5
5
  SHA512:
6
- metadata.gz: cacffbc4532af2dd6bc857b7173d0526ee836dd8c0b2536ac80d29001a29754a69a9b8a7838571a7b420dee514d0887978aa34f1f838321a7eab599910286380
7
- data.tar.gz: 980b12706b49bb370a5c11500b61b6146baab7ed132b73a2a06d859f08469d75e957cf1ff9eff31d0002b505637a55cb8da38ce74ce4fec290d8878ff3a5e2e4
6
+ metadata.gz: 32465ee14a2d9d1c92ad3c85ecf28af73216201e97b670331565097de1004941f6852bb1611a42796b4cfdde1713276dcf22b47a0234e9e7ad317111a3b9958d
7
+ data.tar.gz: ec125f006f421f562078fa4a772dff26fa6e85fe0e43fa0971eea9d1256e028d466ff51eda7dd6da93962fcd76614908e81f61dca778cb1094fb13ad9d4593da
@@ -7,12 +7,12 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
9
  matrix:
10
- ruby-version: ["2.4", "2.5", "2.6", "2.7"]
10
+ ruby-version: ["3.0", "3.1", "3.2", "3.3"]
11
11
 
12
12
  steps:
13
- - uses: actions/checkout@v2
13
+ - uses: actions/checkout@v3
14
14
  - name: Set up Ruby ${{ matrix.ruby-version }}
15
- uses: actions/setup-ruby@v1
15
+ uses: ruby/setup-ruby@v1
16
16
  with:
17
17
  ruby-version: ${{ matrix.ruby-version }}
18
18
  - name: Build and test with Rake
data/.gitignore CHANGED
@@ -15,3 +15,5 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .ruby-version
19
+ .DS_Store
data/README.md CHANGED
@@ -9,14 +9,14 @@ on the [PagerDuty Developer Page](https://developer.pagerduty.com/sign-up/).
9
9
  ## Installation
10
10
 
11
11
  ```ruby
12
- gem 'omniauth-pagerduty', github: 'kwent/omniauth-pagerduty', branch: 'master'
12
+ gem 'omniauth-pagerduty'
13
13
  ```
14
14
 
15
15
  ## Basic Usage
16
16
 
17
17
  ```ruby
18
18
  use OmniAuth::Builder do
19
- provider :pagerduty, ENV['PAGERDUTY_KEY'], ENV['PAGERDUTY_SECRET']
19
+ provider :pagerduty, ENV['PAGERDUTY_CLIENT_ID'], ENV['PAGERDUTY_CLIENT_SECRET']
20
20
  end
21
21
  ```
22
22
 
@@ -26,20 +26,10 @@ In `config/initializers/pagerduty.rb`
26
26
 
27
27
  ```ruby
28
28
  Rails.application.config.middleware.use OmniAuth::Builder do
29
- provider :pagerduty, ENV['PAGERDUTY_KEY'], ENV['PAGERDUTY_SECRET']
29
+ provider :pagerduty, ENV['PAGERDUTY_CLIENT_ID'], ENV['PAGERDUTY_CLIENT_SECRET']
30
30
  end
31
31
  ```
32
32
 
33
- ## Scopes
34
-
35
- PagerDuty API v3 lets you set scopes to provide granular access to different types of data:
36
-
37
- ```ruby
38
- use OmniAuth::Builder do
39
- provider :pagerduty, ENV['PAGERDUTY_KEY'], ENV['PAGERDUTY_SECRET']
40
- end
41
- ```
42
-
43
33
  ## Semver
44
34
 
45
35
  This project adheres to Semantic Versioning 2.0.0. Any violations of this scheme are considered to be bugs.
@@ -1,4 +1,5 @@
1
1
  require 'omniauth-oauth2'
2
+ require 'digest'
2
3
 
3
4
  module OmniAuth
4
5
  module Strategies
@@ -6,13 +7,10 @@ module OmniAuth
6
7
  option :client_options, {
7
8
  site: 'https://api.pagerduty.com',
8
9
  authorize_url: 'https://app.pagerduty.com/oauth/authorize',
9
- token_url: 'https://app.pagerduty.com/oauth/token',
10
- response_type: 'code',
11
- }
12
-
13
- option :auth_token_params, {
14
- grant_type: 'authorization_code',
10
+ token_url: 'https://app.pagerduty.com/oauth/token'
15
11
  }
12
+
13
+ option :pkce, true
16
14
 
17
15
  def request_phase
18
16
  super
@@ -44,11 +42,11 @@ module OmniAuth
44
42
  end
45
43
 
46
44
  def callback_url
47
- full_host + script_name + callback_path
45
+ options.redirect_url || (full_host + callback_path)
48
46
  end
49
47
  end
50
48
  end
51
49
  end
52
50
 
53
51
  OmniAuth.config.add_camelization 'pagerduty', 'PagerDuty'
54
- OmniAuth.config.add_camelization 'pager_duty', 'PagerDuty'
52
+ OmniAuth.config.add_camelization 'pager_duty', 'PagerDuty'
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module PagerDuty
3
- VERSION = "1.0.0"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
@@ -16,8 +16,11 @@ Gem::Specification.new do |gem|
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = OmniAuth::PagerDuty::VERSION
18
18
 
19
- gem.add_dependency 'omniauth', '~> 1.5'
19
+ gem.required_ruby_version = ">= 3"
20
+
21
+ gem.add_dependency 'omniauth', '~> 2.0.0'
20
22
  gem.add_dependency 'omniauth-oauth2', '>= 1.4.0', '< 2.0'
23
+
21
24
  gem.add_development_dependency 'rspec', '~> 3.5'
22
25
  gem.add_development_dependency 'rack-test'
23
26
  gem.add_development_dependency 'simplecov'
@@ -9,7 +9,7 @@ describe OmniAuth::Strategies::PagerDuty do
9
9
  let(:enterprise_authorize_url) { 'https://some.other.site.com/login/oauth/authorize' }
10
10
  let(:enterprise_token_url) { 'https://some.other.site.com/login/oauth/token' }
11
11
  let(:enterprise) do
12
- OmniAuth::Strategies::PagerDuty.new('PAGERDUTY_KEY', 'PAGERDUTY_SECRET',
12
+ OmniAuth::Strategies::PagerDuty.new('PAGERDUTY_CLIENT_ID', 'PAGERDUTY_CLIENT_SECRET',
13
13
  {
14
14
  :client_options => {
15
15
  :site => enterprise_site,
@@ -57,11 +57,24 @@ describe OmniAuth::Strategies::PagerDuty do
57
57
  end
58
58
 
59
59
  describe '#callback_url' do
60
- it 'is a combination of host, script name, and callback path' do
61
- allow(subject).to receive(:full_host).and_return('https://example.com')
62
- allow(subject).to receive(:script_name).and_return('/sub_uri')
60
+ let(:base_url) { 'https://example.com' }
63
61
 
64
- expect(subject.callback_url).to eq('https://example.com/sub_uri/auth/pagerduty/callback')
62
+ context 'no script name present' do
63
+ it 'has the correct default callback path' do
64
+ allow(subject).to receive(:full_host) { base_url }
65
+ allow(subject).to receive(:script_name) { '' }
66
+ allow(subject).to receive(:query_string) { '' }
67
+ expect(subject.callback_url).to eq(base_url + '/auth/pagerduty/callback')
68
+ end
69
+ end
70
+
71
+ context 'script name' do
72
+ it 'should set the callback path with script_name' do
73
+ allow(subject).to receive(:full_host) { base_url }
74
+ allow(subject).to receive(:script_name) { '/v1' }
75
+ allow(subject).to receive(:query_string) { '' }
76
+ expect(subject.callback_url).to eq(base_url + '/v1/auth/pagerduty/callback')
77
+ end
65
78
  end
66
79
  end
67
80
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-pagerduty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-10 00:00:00.000000000 Z
11
+ date: 2024-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.5'
19
+ version: 2.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.5'
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: omniauth-oauth2
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -125,7 +125,7 @@ homepage: https://pagerduty.com/intridea/omniauth-pagerduty
125
125
  licenses:
126
126
  - MIT
127
127
  metadata: {}
128
- post_install_message:
128
+ post_install_message:
129
129
  rdoc_options: []
130
130
  require_paths:
131
131
  - lib
@@ -133,15 +133,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - ">="
135
135
  - !ruby/object:Gem::Version
136
- version: '0'
136
+ version: '3'
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  requirements:
139
139
  - - ">="
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 3.0.3
144
- signing_key:
143
+ rubygems_version: 3.5.3
144
+ signing_key:
145
145
  specification_version: 4
146
146
  summary: Official OmniAuth strategy for PagerDuty.
147
147
  test_files: