omniauth_cobot 0.2.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c91b6d6f983000b2c8f392cb0532aeb6c5dedf0afbfee30cd3b6adf2b4fb15d
4
- data.tar.gz: 6280f53cfe29d745051263c61f0f670ddd124ecfe8ef6b57955182f78fa3cd37
3
+ metadata.gz: 5695363dcc7584d437846dd02f9a110f125071d47b1ad63d8443d1c321b81e74
4
+ data.tar.gz: d4f5b08566889f9492f4b19f7445560d373723d4b9d893e21e04ee1277b35c6d
5
5
  SHA512:
6
- metadata.gz: 0f549df07238edc70eaa9912b633be07d1d5bc63ed0a9b7e28f5000e2703d5f7546b47cd7b654d380bbdb8925f74c14bd3db1c518362fdc1f196c172f43279e9
7
- data.tar.gz: 3cbf4da8ef6ebc0dd95c01757bc0ae16fb0f3363a516c02d9c441dbb6b216c8aee82e41d98bf988b61ea05a1c90c2e90eff2ccb51eadd323d405ae5edab89480
6
+ metadata.gz: 41f36efe8d264df83f3e4ef41c3d9fe7d84de120448afffa2fd72124a03bf51db9260a8c83af6ef73d52c300ad29c0fa4a507db70c00b757918d9da33490be87
7
+ data.tar.gz: c0f8189ba29bfa270a5a1088a28fdb6532044620d88cd9cfe7ccd89d8188662eed3207360ac3a3ba0907b74ef1a9ba71fffefdef354deb5f8607c7b06b33c2e9
@@ -1,24 +1,23 @@
1
- name: Ruby CI
1
+ name: Push gem
2
+
2
3
  on:
3
4
  push:
4
- branches:
5
- - main
6
- pull_request:
7
- branches:
8
- - main
5
+ tags:
6
+ - "v*"
9
7
  jobs:
10
- test:
8
+ release:
11
9
  runs-on: ubuntu-latest
12
- strategy:
13
- fail-fast: false
14
- matrix:
15
- ruby: ["2.7", "3.0", "3.1"]
10
+ permissions:
11
+ contents: write
12
+ id-token: write
16
13
  steps:
17
- - uses: actions/checkout@v3
14
+ - uses: actions/checkout@v5
15
+ with:
16
+ persist-credentials: false
18
17
  - name: Set up Ruby
19
18
  uses: ruby/setup-ruby@v1
20
19
  with:
21
- ruby-version: ${{ matrix.ruby }}
22
20
  bundler-cache: true
23
- - name: Run tests
24
- run: bundle exec rake
21
+ ruby-version: ruby
22
+ - name: Release gem
23
+ uses: rubygems/release-gem@v1
@@ -0,0 +1,25 @@
1
+ name: Ruby CI
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ pull_request:
7
+ branches:
8
+ - main
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby: ["4.0", "3.4", "3.3"]
16
+ steps:
17
+ - uses: actions/checkout@v5
18
+ - name: Set up Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ bundler-cache: true
23
+ - name: Run tests
24
+ run: bundle exec rake
25
+
data/.gitignore CHANGED
@@ -1 +1,3 @@
1
1
  pkg/*
2
+ *.gem
3
+ Gemfile.lock
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ plugins:
2
+ - rubocop-rake
3
+ - rubocop-rspec
4
+
5
+ AllCops:
6
+ NewCops: enable
7
+ TargetRubyVersion: 3.2
8
+
9
+ RSpec/ExampleLength:
10
+ Enabled: false
11
+
12
+ Style/Documentation:
13
+ Enabled: false
data/CHANGES.md ADDED
@@ -0,0 +1,8 @@
1
+ # 1.0.0
2
+
3
+ - Add support for Ruby v4
4
+ - Drop support for EOL Rubies (< 3.3)
5
+
6
+ # 0.2.0
7
+
8
+ - add using space subdomain in authorize url
data/Gemfile CHANGED
@@ -1,4 +1,12 @@
1
- source "http://rubygems.org"
1
+ # frozen_string_literal: true
2
+
3
+ source 'http://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in omniauth_cobot.gemspec
4
6
  gemspec
7
+
8
+ gem 'rake'
9
+ gem 'rspec', '~>3.12'
10
+ gem 'rubocop'
11
+ gem 'rubocop-rake'
12
+ gem 'rubocop-rspec'
data/README.md CHANGED
@@ -4,13 +4,20 @@ This gem provides an [OmniAuth](https://github.com/intridea/omniauth) strategy f
4
4
 
5
5
  ### Rails
6
6
 
7
+ Add the following to your Gemfile:
8
+
9
+ ````ruby
10
+ gem 'omniauth_cobot'
11
+ gem 'omniauth-rails_csrf_protection', '~>1.0.0'
12
+ ``
13
+
7
14
  Add the following as an initializer:
8
15
 
9
16
  ```ruby
10
17
  Rails.application.config.middleware.use OmniAuth::Builder do
11
18
  provider :cobot, '<client_id>', '<client_secret>', scope: 'read write'
12
19
  end
13
- ```
20
+ ````
14
21
 
15
22
  To authenticate a user against Cobot, send them to `/auth/cobot`.
16
23
 
data/Rakefile CHANGED
@@ -1,11 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler'
2
4
  Bundler::GemHelper.install_tasks
3
5
 
4
6
  require 'rspec/core/rake_task'
7
+ require 'rubocop/rake_task'
5
8
 
6
- task default: [:spec]
9
+ task default: %i[spec rubocop]
7
10
 
8
- desc "Run the specs."
11
+ desc 'Run the specs.'
9
12
  RSpec::Core::RakeTask.new do |t|
10
- t.pattern = "spec/**/*_spec.rb"
11
- end
13
+ t.pattern = 'spec/**/*_spec.rb'
14
+ end
15
+
16
+ RuboCop::RakeTask.new(:rubocop)
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module OmniAuth
2
4
  module Cobot
3
- VERSION = '0.2.0'
5
+ VERSION = '1.0.0'
4
6
  end
5
7
  end
@@ -1,18 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'omniauth/strategies/oauth2'
2
4
 
3
5
  module OmniAuth
4
6
  module Strategies
5
7
  class Cobot < OmniAuth::Strategies::OAuth2
6
8
  option :client_options, {
7
- :site => 'https://www.cobot.me',
8
- :authorize_url => 'https://www.cobot.me/oauth/authorize',
9
- :token_url => 'https://www.cobot.me/oauth/access_token'
9
+ site: 'https://www.cobot.me',
10
+ authorize_url: 'https://www.cobot.me/oauth/authorize',
11
+ token_url: 'https://www.cobot.me/oauth/access_token'
10
12
  }
11
13
 
12
14
  def client
13
15
  ::OAuth2::Client.new(
14
- options.client_id,
15
- options.client_secret,
16
+ options.client_id,
17
+ options.client_secret,
16
18
  deep_symbolize(
17
19
  options.client_options.merge(
18
20
  authorize_url: space_subdomain_authorize_url
@@ -20,7 +22,7 @@ module OmniAuth
20
22
  )
21
23
  )
22
24
  end
23
-
25
+
24
26
  def space_subdomain_authorize_url
25
27
  params = Rack::Utils.parse_nested_query(env['QUERY_STRING'])
26
28
  if (subdomain = params['cobot_space_subdomain'])
@@ -40,7 +42,7 @@ module OmniAuth
40
42
  end
41
43
 
42
44
  extra do
43
- {:raw_info => raw_info}
45
+ { raw_info: raw_info }
44
46
  end
45
47
 
46
48
  def raw_info
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'omniauth'
2
4
  require 'omniauth/strategies/cobot'
@@ -1,24 +1,24 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "omniauth/cobot/version"
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+ require 'omniauth/cobot/version'
4
5
 
5
6
  Gem::Specification.new do |s|
6
- s.name = "omniauth_cobot"
7
- s.summary = "OmniAuth strategy for Cobot"
8
- s.email = "alex@cobot.me"
9
- s.homepage = "http://github.com/cobot/omniauth_cobot"
10
- s.description = "OmniAuth strategy for Cobot"
11
- s.authors = ["Alexander Lang"]
7
+ s.name = 'omniauth_cobot'
8
+ s.summary = 'OmniAuth strategy for Cobot'
9
+ s.email = 'alex@cobot.me'
10
+ s.homepage = 'http://github.com/cobot/omniauth_cobot'
11
+ s.description = 'OmniAuth strategy for Cobot'
12
+ s.authors = ['Alexander Lang']
12
13
  s.version = OmniAuth::Cobot::VERSION
13
14
  s.platform = Gem::Platform::RUBY
14
15
 
15
- s.add_dependency 'omniauth-oauth2', '~>1.8.0'
16
+ s.required_ruby_version = ['>=3.2', '<5']
16
17
 
17
- s.add_development_dependency 'rake'
18
- s.add_development_dependency 'rspec', '~>3.12'
18
+ s.add_dependency 'omniauth-oauth2', '~>1.8'
19
19
 
20
20
  s.files = `git ls-files`.split("\n")
21
- s.test_files = `git ls-files -- spec/*`.split("\n")
22
21
  # s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
- s.require_paths = ["lib"]
22
+ s.require_paths = ['lib']
23
+ s.metadata['rubygems_mfa_required'] = 'true'
24
24
  end
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe OmniAuth::Strategies::Cobot do
4
6
  let(:app) do
5
7
  lambda do |_env|
6
- [200, {}, ["Hello."]]
8
+ [200, {}, ['Hello.']]
7
9
  end
8
10
  end
9
- let(:strategy) { Class.new(OmniAuth::Strategies::Cobot) }
11
+ let(:strategy) { Class.new(described_class) }
10
12
 
11
13
  before do
12
14
  OmniAuth.config.test_mode = true
@@ -16,10 +18,9 @@ RSpec.describe OmniAuth::Strategies::Cobot do
16
18
  OmniAuth.config.test_mode = false
17
19
  end
18
20
 
19
-
20
21
  it 'takes the cobot_space_sudomain query param and changes the subdomain of the authorize_url' do
21
22
  subject = strategy
22
- .new(app, client_options: {authorize_url: 'https://www.cobot.me'})
23
+ .new(app, client_options: { authorize_url: 'https://www.cobot.me' })
23
24
 
24
25
  subject.call!(
25
26
  {
@@ -27,37 +28,36 @@ RSpec.describe OmniAuth::Strategies::Cobot do
27
28
  'QUERY_STRING' => 'cobot_space_subdomain=my-space'
28
29
  }
29
30
  )
30
-
31
+
31
32
  expect(subject.client.authorize_url)
32
33
  .to eq('https://my-space.cobot.me')
33
34
  end
34
35
 
35
36
  it 'does not change the subdomain of the authorize_url when no cobot_space_subdomain passed' do
36
37
  subject = strategy
37
- .new(app, client_options: {authorize_url: 'https://www.cobot.me'})
38
+ .new(app, client_options: { authorize_url: 'https://www.cobot.me' })
38
39
 
39
40
  subject.call!(
40
41
  {
41
42
  'rack.session' => {}
42
43
  }
43
44
  )
44
-
45
+
45
46
  expect(subject.client.authorize_url)
46
47
  .to eq('https://www.cobot.me')
47
48
  end
48
49
 
49
50
  it 'does nothing if no authorize_url configured' do
50
51
  subject = strategy
51
- .new(app, {})
52
+ .new(app, {})
52
53
 
53
54
  subject.call!(
54
55
  {
55
56
  'rack.session' => {}
56
57
  }
57
58
  )
58
-
59
+
59
60
  expect(subject.client.authorize_url)
60
61
  .to eq('https://www.cobot.me/oauth/authorize')
61
62
  end
62
-
63
- end
63
+ end
data/spec/spec_helper.rb CHANGED
@@ -1 +1,3 @@
1
- require 'omniauth_cobot'
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth_cobot'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth_cobot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Lang
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2022-11-03 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: omniauth-oauth2
@@ -16,42 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: 1.8.0
18
+ version: '1.8'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: 1.8.0
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.12'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.12'
25
+ version: '1.8'
55
26
  description: OmniAuth strategy for Cobot
56
27
  email: alex@cobot.me
57
28
  executables: []
@@ -60,9 +31,11 @@ extra_rdoc_files: []
60
31
  files:
61
32
  - ".github/dependabot.yml"
62
33
  - ".github/workflows/ruby.yml"
34
+ - ".github/workflows/test.yml"
63
35
  - ".gitignore"
36
+ - ".rubocop.yml"
37
+ - CHANGES.md
64
38
  - Gemfile
65
- - Gemfile.lock
66
39
  - MIT_LICENSE.txt
67
40
  - README.md
68
41
  - Rakefile
@@ -70,12 +43,12 @@ files:
70
43
  - lib/omniauth/strategies/cobot.rb
71
44
  - lib/omniauth_cobot.rb
72
45
  - omniauth_cobot.gemspec
46
+ - spec/omni_auth/strategies/cobot_spec.rb
73
47
  - spec/spec_helper.rb
74
- - spec/strategy_spec.rb
75
48
  homepage: http://github.com/cobot/omniauth_cobot
76
49
  licenses: []
77
- metadata: {}
78
- post_install_message:
50
+ metadata:
51
+ rubygems_mfa_required: 'true'
79
52
  rdoc_options: []
80
53
  require_paths:
81
54
  - lib
@@ -83,17 +56,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
56
  requirements:
84
57
  - - ">="
85
58
  - !ruby/object:Gem::Version
86
- version: '0'
59
+ version: '3.2'
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '5'
87
63
  required_rubygems_version: !ruby/object:Gem::Requirement
88
64
  requirements:
89
65
  - - ">="
90
66
  - !ruby/object:Gem::Version
91
67
  version: '0'
92
68
  requirements: []
93
- rubygems_version: 3.2.32
94
- signing_key:
69
+ rubygems_version: 4.0.10
95
70
  specification_version: 4
96
71
  summary: OmniAuth strategy for Cobot
97
- test_files:
98
- - spec/spec_helper.rb
99
- - spec/strategy_spec.rb
72
+ test_files: []
data/Gemfile.lock DELETED
@@ -1,65 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- omniauth_cobot (0.2.0)
5
- omniauth-oauth2 (~> 1.8.0)
6
-
7
- GEM
8
- remote: http://rubygems.org/
9
- specs:
10
- diff-lcs (1.5.0)
11
- faraday (2.6.0)
12
- faraday-net_http (>= 2.0, < 3.1)
13
- ruby2_keywords (>= 0.0.4)
14
- faraday-net_http (3.0.1)
15
- hashie (5.0.0)
16
- jwt (2.5.0)
17
- multi_xml (0.6.0)
18
- oauth2 (2.0.9)
19
- faraday (>= 0.17.3, < 3.0)
20
- jwt (>= 1.0, < 3.0)
21
- multi_xml (~> 0.5)
22
- rack (>= 1.2, < 4)
23
- snaky_hash (~> 2.0)
24
- version_gem (~> 1.1)
25
- omniauth (2.1.0)
26
- hashie (>= 3.4.6)
27
- rack (>= 2.2.3)
28
- rack-protection
29
- omniauth-oauth2 (1.8.0)
30
- oauth2 (>= 1.4, < 3)
31
- omniauth (~> 2.0)
32
- rack (3.0.0)
33
- rack-protection (3.0.2)
34
- rack
35
- rake (13.0.1)
36
- rspec (3.12.0)
37
- rspec-core (~> 3.12.0)
38
- rspec-expectations (~> 3.12.0)
39
- rspec-mocks (~> 3.12.0)
40
- rspec-core (3.12.0)
41
- rspec-support (~> 3.12.0)
42
- rspec-expectations (3.12.0)
43
- diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.12.0)
45
- rspec-mocks (3.12.0)
46
- diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.12.0)
48
- rspec-support (3.12.0)
49
- ruby2_keywords (0.0.5)
50
- snaky_hash (2.0.1)
51
- hashie
52
- version_gem (~> 1.1, >= 1.1.1)
53
- version_gem (1.1.1)
54
-
55
- PLATFORMS
56
- arm64-darwin-21
57
- x86_64-linux
58
-
59
- DEPENDENCIES
60
- omniauth_cobot!
61
- rake
62
- rspec (~> 3.12)
63
-
64
- BUNDLED WITH
65
- 2.3.20