omniauth-pagerduty 1.0.0 → 2.0.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 +4 -4
- data/.github/workflows/ruby.yml +3 -3
- data/.gitignore +2 -0
- data/README.md +3 -13
- data/lib/omniauth/strategies/pagerduty.rb +6 -8
- data/lib/omniauth-pagerduty/version.rb +1 -1
- data/omniauth-pagerduty.gemspec +4 -1
- data/spec/omniauth/strategies/pagerduty_spec.rb +18 -5
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 375ec937ffed26c1d1b993f31408aa944f269bd6864bc1628c4a5b7c0da20249
|
4
|
+
data.tar.gz: 3a7351de98716415128707c2b41c35f8d441fe8d8782b84b99aa22589069b3ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32465ee14a2d9d1c92ad3c85ecf28af73216201e97b670331565097de1004941f6852bb1611a42796b4cfdde1713276dcf22b47a0234e9e7ad317111a3b9958d
|
7
|
+
data.tar.gz: ec125f006f421f562078fa4a772dff26fa6e85fe0e43fa0971eea9d1256e028d466ff51eda7dd6da93962fcd76614908e81f61dca778cb1094fb13ad9d4593da
|
data/.github/workflows/ruby.yml
CHANGED
@@ -7,12 +7,12 @@ jobs:
|
|
7
7
|
runs-on: ubuntu-latest
|
8
8
|
strategy:
|
9
9
|
matrix:
|
10
|
-
ruby-version: ["
|
10
|
+
ruby-version: ["3.0", "3.1", "3.2", "3.3"]
|
11
11
|
|
12
12
|
steps:
|
13
|
-
- uses: actions/checkout@
|
13
|
+
- uses: actions/checkout@v3
|
14
14
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
15
|
-
uses:
|
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
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'
|
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['
|
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['
|
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
|
-
|
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'
|
data/omniauth-pagerduty.gemspec
CHANGED
@@ -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.
|
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('
|
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
|
-
|
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
|
-
|
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:
|
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:
|
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:
|
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:
|
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: '
|
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.
|
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:
|