omniauth-slack-openid 1.2.0 → 2.0.2

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: a0b8da342cc5012b1efbfb15c73e72dfd8718074217b4ae5969d5b4a6c3fbadc
4
- data.tar.gz: a5fbb3cf54c8126ad6a902c4f5f866ca081d9d0aadb701f2aedaa0eb6925dcec
3
+ metadata.gz: a256da614c4c1a1a8f3dacef90e2a16274f115d0c2d54b018c29fbaf6c1e88d2
4
+ data.tar.gz: 8d4146fe35d563f9d47b32047d909ef2228ed5b24c2dbd66ff73c378592a75ae
5
5
  SHA512:
6
- metadata.gz: 3f1b25a66258bec67245cfa69c7b1b4ceaa12e5114740a039d66b1bb770e1a2184af4b08cacc03f33516072b9ccf08543a93d51eb4f2468dda4b4fa723bf338a
7
- data.tar.gz: 0d1c1afc9074f073710a6f01489c5ec0367e9f8b624a1e9716e6dabbd6f3c4063babad419d3f92ca31ea4e127df85515842777db13ee2e8c957f3cb924653ea1
6
+ metadata.gz: 3249cc0e089f984a778bbc9dfaa9e7e84979eade78488681abd010d878e1d9ef49b26af5eb62b5b8316e18fbcbbbb7818eee4fb73af71e10164c2851fe4e9639
7
+ data.tar.gz: 8e463d032d37cdced78f3ad13974854a5f59ffced90f3b2e13dfd155bc8cb472bef3758b8d6d8e3ebaffb11fafafcab73c26edec9ec7003902e567e8f7ca5ed6
data/CHANGELOG.md CHANGED
@@ -1,19 +1,46 @@
1
- # 1.2.0
1
+ # CHANGELOG
2
2
 
3
- * Switch from Data to Struct
3
+ ## 2.0.2 (2026-12-02)
4
4
 
5
- # 1.1.0
5
+ - Fix Sign-in with Slack when the app is mounted under a path prefix
6
+ - Keep configured workspace and scopes when a sign-in request supplies nested parameters
7
+ - Reject non-string or blank workspace and user identifiers from Slack userInfo
8
+ - Require OmniAuth 2.3.1 or newer (host checks for Sign-in with Slack callbacks)
9
+ - Require omniauth-oauth2 1.10.1 or newer and oauth2 2.1.0 or newer
10
+ - Document supported runtimes: CI-tested CRuby/MRI 3.4 and 4.0; best-effort JRuby, TruffleRuby, and other implementations that can install the runtime dependencies and run OmniAuth/Rack; Ruby older than 3.4 and Spinel AOT not supported
11
+ - Document workspace selection, scope isolation, PKCE, and token rotation for Sign-in with Slack hosts
6
12
 
7
- * Set minimum ruby version requirement to 2.5.0
13
+ ## 2.0.1 (2026-07-19)
8
14
 
9
- # 1.0.2
15
+ - Omit `info[:email]` unless Slack reports `email_verified: true` (unverified email stays on `extra`)
16
+ - Document userInfo-based identity (no `id_token` JWT validation) and keep CSRF state checks enabled in examples
17
+ - Commit Ruby 4.0 appraisal lockfile; Dependabot watches `gemfiles/`
18
+ - Cover non-Hash userInfo, request `scope`, and AuthHash build from userInfo; split strategy specs by concern
19
+ - Raise Polyrun coverage floor to 100% line coverage on tracked lib files
10
20
 
11
- * Updated gem configuration
21
+ ## 2.0.0 (2026-07-19)
12
22
 
13
- # 1.0.1
23
+ - BREAKING: Require Ruby 3.4 or newer
24
+ - BREAKING: Fail authentication when Slack userInfo returns an error or omits team/user ids
25
+ - BREAKING: Raise `ArgumentError` from `generate_uid` when team or user id is blank
26
+ - Pass Slack `team` (and `scope`) through authorize params for workspace-scoped sign-in
14
27
 
15
- * Updated gem description
28
+ ## 1.2.0 (2023-08-30)
16
29
 
17
- # 1.0.0
30
+ - Switch info payload helper from `Data` to `Struct`
18
31
 
19
- * Initial version
32
+ ## 1.1.0 (2023-08-30)
33
+
34
+ - Require Ruby 2.5 or newer
35
+
36
+ ## 1.0.2 (2023-08-29)
37
+
38
+ - Update gem packaging configuration
39
+
40
+ ## 1.0.1 (2023-08-28)
41
+
42
+ - Update gem description
43
+
44
+ ## 1.0.0 (2023-08-28)
45
+
46
+ - Initial release
data/README.md CHANGED
@@ -1,12 +1,18 @@
1
1
  # omniauth-slack-openid.rb
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/omniauth-slack-openid.svg)](https://badge.fury.io/rb/omniauth-slack-openid) [![Test Status](https://github.com/amkisko/omniauth-slack-openid.rb/actions/workflows/test.yml/badge.svg)](https://github.com/amkisko/omniauth-slack-openid.rb/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/amkisko/omniauth-slack-openid.rb/graph/badge.svg?token=HIOT78D47F)](https://codecov.io/gh/amkisko/omniauth-slack-openid.rb)
3
+ [![Gem Version](https://badge.fury.io/rb/omniauth-slack-openid.svg)](https://badge.fury.io/rb/omniauth-slack-openid) [![Test Status](https://github.com/amkisko/omniauth-slack-openid.rb/actions/workflows/test.yml/badge.svg)](https://github.com/amkisko/omniauth-slack-openid.rb/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/amkisko/omniauth-slack-openid.rb/graph/badge.svg?token=HIOT78D47F)](https://app.codecov.io/github/amkisko/omniauth-slack-openid.rb)
4
4
 
5
5
  An OmniAuth strategy for implementing Sign-in with Slack using OpenID Connect.
6
6
 
7
- Official documentation: https://api.slack.com/authentication/sign-in-with-slack
7
+ [Slack's Sign in with Slack guide](https://docs.slack.dev/authentication/sign-in-with-slack/)
8
8
 
9
- Sponsored by [Kisko Labs](https://www.kiskolabs.com).
9
+ ## Identity model
10
+
11
+ This strategy exchanges the OAuth authorization code for an access token and loads the session identity from Slack's `openid.connect.userInfo` endpoint. Slack must supply a non-blank string for both the workspace and the user ID. The AuthHash UID has the form `team_id-user_id`.
12
+
13
+ The strategy leaves `id_token` opaque and provides no ID token verification. Slack's [Node](https://github.com/slackapi/node-slack-sdk/blob/main/examples/openid-connect/app.js), [Python](https://github.com/slackapi/python-slack-sdk/blob/main/integration_tests/samples/openid_connect/sanic_example.py), and [Java](https://docs.slack.dev/tools/java-slack-sdk/guides/sign-in-with-slack/) examples decode it without verifying its signature against Slack's public keys. Applications that need ID token claims for authentication must use a verifier.
14
+
15
+ `info[:email]` is set when Slack reports `email_verified: true`. Unverified addresses stay on `extra[:data].email` and `extra[:raw_info]` for display or support flows.
10
16
 
11
17
  ## Install
12
18
 
@@ -20,6 +26,12 @@ Using RubyGems:
20
26
  gem install omniauth-slack-openid
21
27
  ```
22
28
 
29
+ ## Supported runtimes
30
+
31
+ - CI-tested: CRuby/MRI 3.4 and 4.0.
32
+ - Best-effort (no CI matrix): JRuby, TruffleRuby, and other Ruby implementations that can install this gem's runtime dependencies and run OmniAuth/Rack.
33
+ - Not supported: Ruby older than 3.4. [Spinel](https://github.com/matz/spinel) AOT is not an OmniAuth host for this gem.
34
+
23
35
  ## Gemfile
24
36
 
25
37
  ```ruby
@@ -29,13 +41,9 @@ gem 'omniauth-slack-openid'
29
41
  ## Usage with Devise
30
42
 
31
43
  Create Slack app and configure OAuth & Permissions to have the following Redirect URLs:
32
- - https://localhost:3000/user/auth/slack_openid/callback
44
+ - `https://myapp.rails.fi:3000/user/auth/slack_openid/callback`
33
45
 
34
- Copy `Client ID` and `Client Secret` to your environment (e.g. `.env.local` file):
35
- ```sh
36
- SLACK_CLIENT_ID=1234567890.1234567890
37
- SLACK_CLIENT_SECRET=1234567890abcdef1234567890abcdef
38
- ```
46
+ Load `SLACK_CLIENT_ID` and `SLACK_CLIENT_SECRET` into the application environment from your credential store.
39
47
 
40
48
  Add the following to your `config/initializers/devise.rb`:
41
49
 
@@ -45,18 +53,29 @@ Add the following to your `config/initializers/devise.rb`:
45
53
  ENV.fetch("SLACK_CLIENT_ID"),
46
54
  ENV.fetch("SLACK_CLIENT_SECRET"),
47
55
  {
48
- scope: "openid,email,profile",
49
- redirect_uri: Rails.env.development? ? "https://localhost:3000/user/auth/slack_openid/callback" : nil,
50
- provider_ignores_state: Rails.env.development?
56
+ scope: "openid email profile",
57
+ redirect_uri: Rails.env.development? ? "https://myapp.rails.fi:3000/user/auth/slack_openid/callback" : nil
51
58
  }
52
59
  )
53
60
  ```
54
61
 
55
- In order to test the callback in development, try logging in and then manually update URL to use http instead of https.
62
+ Keep OmniAuth's state checks enabled and use the registered callback URL for both authorization and token exchange. Prefer a fixed `redirect_uri` (as in the example) or set `OmniAuth.config.full_host` / `OmniAuth.config.allowed_hosts` so forged Host headers cannot shape the Slack callback URL.
63
+
64
+ ### Scopes and workspaces
65
+
66
+ Request `openid` and optionally `email` and `profile`. Slack's guide uses spaces. The official SDK examples also use comma-separated scopes such as `openid,email,profile`. Request bot and other Slack API scopes in a separate OAuth flow.
67
+
68
+ Set `team: "T0123456789"` in the strategy options to suggest a workspace, including a workspace in Enterprise Grid. A `?team=T0123456789` query parameter on the sign-in POST can override the default for that request. Enforce workspace access using the workspace ID returned by Slack and your application's access policy.
69
+
70
+ ### PKCE and token rotation
71
+
72
+ Set `pkce: true` only if you have enabled PKCE for the Slack app. Enabling it in Slack marks the app as a public client. Reversing that setting requires Slack support. See [Slack's PKCE guide](https://docs.slack.dev/authentication/using-pkce/).
73
+
74
+ For expiring tokens, read `expires_at` and the supplied `refresh_token` from `auth.credentials`. If your application needs access beyond sign-in, store the credentials securely, refresh through `openid.connect.token` with `grant_type=refresh_token`, and save the replacement pair together. The host application owns token rotation. See [Slack's Sign in with Slack rotation instructions](https://docs.slack.dev/authentication/sign-in-with-slack/#token-rotation). For direct API calls, [slack-ruby-client](https://github.com/slack-ruby/slack-ruby-client) offers `openid_connect_token` and `openid_connect_userInfo`.
56
75
 
57
76
  ## Generating uid
58
77
 
59
- Gem has own `generate_uid` method that concatenates `team_id` and `user_id`, you can use it with custom parameters:
78
+ The gem provides `generate_uid`, which joins `team_id` and `user_id`. Call it with your own parameters when you need the same compound id:
60
79
 
61
80
  ```ruby
62
81
  def resolve_user_session(team_id, user_id)
@@ -69,14 +88,43 @@ end
69
88
 
70
89
  Bug reports and pull requests are welcome on GitHub at https://github.com/amkisko/omniauth-slack-openid.rb
71
90
 
91
+ Run `bundle exec ruby -Ilib usr/reports/slack_oidc_discovery.rb` to compare the live discovery endpoints and public key set with the strategy defaults.
92
+
93
+ Run `bundle exec ruby -Ilib usr/reports/runtime_support.rb` to print the engine and version and load the strategy. Maintainers may run the same command on JRuby or TruffleRuby when checking best-effort support.
94
+
95
+ For a manual sign-in smoke check, register a local `rails.fi` callback with Slack and load `SLACK_CLIENT_ID`, `SLACK_CLIENT_SECRET`, `SLACK_REDIRECT_URI`, and optionally `SLACK_TEAM` into your environment. Run `bundle exec ruby -Ilib usr/scripts/slack_oidc_smoke.rb`, open the printed URL, approve the request, then paste the full callback URL from the address bar into the hidden prompt. The CLI completes the callback locally and prints a redacted AuthHash summary. Add `--refresh` to rotate the smoke account's token and check that it returns the same Slack identity.
96
+
72
97
  ## Publishing
73
98
 
99
+ Maintainers cut a release from a clean worktree with:
100
+
74
101
  ```sh
75
- rm omniauth-slack-openid-*.gem
76
- gem build omniauth-slack-openid.gemspec
77
- gem push omniauth-slack-openid-*.gem
102
+ make release
78
103
  ```
79
104
 
105
+ That path installs appraisals, runs lint and covered polyrun specs per appraisal, checks changelog notes, builds the gem under `tmp/release`, asks for confirmation, waits for RubyGems to list the package, then tags and creates the GitHub release. Use `make release-build` for a local artifact only, or `ruby usr/bin/release.rb --artifacts DIR` to finish a partial publish.
106
+
107
+ ## Links
108
+
109
+ - [GitHub](https://github.com/amkisko/omniauth-slack-openid.rb)
110
+ - [GitLab](https://gitlab.com/amkisko/omniauth-slack-openid.rb)
111
+ - [RubyGems](https://rubygems.org/gems/omniauth-slack-openid)
112
+ - [Versions Atom](https://rubygems.org/gems/omniauth-slack-openid/versions.atom) (feed id `5816970036548`)
113
+ - [libraries.io](https://libraries.io/rubygems/omniauth-slack-openid)
114
+ - [Deps.dev](https://deps.dev/rubygems/omniauth-slack-openid)
115
+ - [SonarCloud](https://sonarcloud.io/project/overview?id=amkisko_omniauth-slack-openid.rb)
116
+ - [Snyk](https://snyk.io/test/github/amkisko/omniauth-slack-openid.rb)
117
+ - [Codecov](https://app.codecov.io/github/amkisko/omniauth-slack-openid.rb)
118
+ - [OpenSSF Scorecard](https://scorecard.dev/viewer/?uri=github.com/amkisko/omniauth-slack-openid.rb)
119
+
80
120
  ## License
81
121
 
82
122
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
123
+
124
+ ## Sponsors
125
+
126
+ Sponsored by [Kisko Labs](https://www.kiskolabs.com).
127
+
128
+ <a href="https://www.kiskolabs.com">
129
+ <img src="kisko.svg" width="200" alt="Sponsored by Kisko Labs" />
130
+ </a>
@@ -1,7 +1,7 @@
1
- require 'omniauth/strategies/slack_openid'
1
+ require "omniauth/strategies/slack_openid"
2
2
 
3
3
  module OmniAuth
4
4
  module SlackOpenid
5
- VERSION = '1.2.0'
5
+ VERSION = "2.0.2"
6
6
  end
7
7
  end
@@ -1,10 +1,15 @@
1
- require 'omniauth/strategies/oauth2'
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth/strategies/oauth2"
2
4
 
3
5
  module OmniAuth
4
6
  module Strategies
5
7
  class SlackOpenid < OmniAuth::Strategies::OAuth2
6
- AUTH_OPTIONS = %i[scope user_scope team team_domain].freeze
8
+ AUTH_OPTIONS = %i[scope team].freeze
9
+ USER_INFO_PATH = "/api/openid.connect.userInfo"
7
10
 
11
+ # keyword_init stays explicit so keyword construction matches call sites on alternate engines.
12
+ # rubocop:disable Style/RedundantStructKeywordInit
8
13
  INFO_DATA = Struct.new(
9
14
  :user_id,
10
15
  :team_id,
@@ -16,21 +21,30 @@ module OmniAuth
16
21
  :family_name,
17
22
  :locale,
18
23
  :team_name,
19
- :team_domain
24
+ :team_domain,
25
+ keyword_init: true
20
26
  )
27
+ # rubocop:enable Style/RedundantStructKeywordInit
21
28
 
22
29
  option :name, "slack_openid"
23
30
  option :client_options,
24
- {
25
- site: "https://slack.com",
26
- authorize_url: "/openid/connect/authorize",
27
- token_url: "/api/openid.connect.token"
28
- }
31
+ {
32
+ site: "https://slack.com",
33
+ authorize_url: "/openid/connect/authorize",
34
+ token_url: "/api/openid.connect.token"
35
+ }
29
36
 
30
37
  option :redirect_uri
38
+ option :authorize_options, AUTH_OPTIONS
31
39
 
32
40
  def self.generate_uid(team_id, user_id)
33
- "#{team_id}-#{user_id}"
41
+ team = team_id.to_s
42
+ user = user_id.to_s
43
+ if team.empty? || user.empty?
44
+ raise ArgumentError, "team_id and user_id are required"
45
+ end
46
+
47
+ "#{team}-#{user}"
34
48
  end
35
49
 
36
50
  uid do
@@ -40,11 +54,13 @@ module OmniAuth
40
54
  )
41
55
  end
42
56
 
43
- info do {
44
- name: raw_info["name"],
45
- email: raw_info["email"],
46
- image: raw_info["picture"]
47
- } end
57
+ info do
58
+ {
59
+ name: raw_info["name"],
60
+ email: (raw_info["email"] if raw_info["email_verified"] == true),
61
+ image: raw_info["picture"]
62
+ }
63
+ end
48
64
 
49
65
  extra do
50
66
  {
@@ -66,12 +82,50 @@ module OmniAuth
66
82
  }
67
83
  end
68
84
 
85
+ def authorize_params
86
+ super.tap do |params|
87
+ request_params = request.params
88
+ AUTH_OPTIONS.each do |key|
89
+ value = request_params[key.to_s]
90
+ params[key] = value if value.is_a?(String) && !value.empty?
91
+ end
92
+ end
93
+ end
94
+
69
95
  def callback_url
70
- options.redirect_uri || (full_host + script_name + callback_path)
96
+ options.redirect_uri || (full_host + callback_path)
71
97
  end
72
98
 
73
99
  def raw_info
74
- @raw_info ||= access_token.get("/api/openid.connect.userInfo").parsed
100
+ @raw_info ||= fetch_and_validate_user_info
101
+ end
102
+
103
+ private
104
+
105
+ def fetch_and_validate_user_info
106
+ response = access_token.get(USER_INFO_PATH).parsed
107
+ unless response.is_a?(Hash) && response["ok"] == true
108
+ error = response.is_a?(Hash) ? response["error"] : nil
109
+ raise CallbackError.new(
110
+ :invalid_credentials,
111
+ "Slack userInfo failed#{": #{error}" if error}"
112
+ )
113
+ end
114
+
115
+ team_id = response["https://slack.com/team_id"]
116
+ user_id = response["https://slack.com/user_id"]
117
+ unless valid_identifier?(team_id) && valid_identifier?(user_id)
118
+ raise CallbackError.new(
119
+ :invalid_credentials,
120
+ "Slack userInfo missing team_id or user_id"
121
+ )
122
+ end
123
+
124
+ response
125
+ end
126
+
127
+ def valid_identifier?(value)
128
+ value.is_a?(String) && value.match?(/[^[:space:]]/)
75
129
  end
76
130
  end
77
131
  end
@@ -1 +1 @@
1
- require 'omniauth/slack_openid'
1
+ require "omniauth/slack_openid"
@@ -1,11 +1,8 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
1
  Gem::Specification.new do |gem|
4
2
  gem.name = "omniauth-slack-openid"
5
- gem.version = File.read(File.expand_path('../lib/omniauth/slack_openid.rb', __FILE__)).match(/VERSION\s*=\s*'(.*?)'/)[1]
3
+ gem.version = File.read(File.expand_path("../lib/omniauth/slack_openid.rb", __FILE__)).match(/VERSION\s*=\s*"(.*?)"/)[1]
6
4
 
7
- repository_url = "https://github.com/amkisko/omniauth-slack-openid.rb"
8
- root_files = %w(CHANGELOG.md LICENSE.md README.md)
5
+ root_files = %w[CHANGELOG.md LICENSE.md README.md]
9
6
  root_files << "#{gem.name}.gemspec"
10
7
 
11
8
  gem.license = "MIT"
@@ -13,32 +10,43 @@ Gem::Specification.new do |gem|
13
10
  gem.platform = Gem::Platform::RUBY
14
11
 
15
12
  gem.authors = ["Andrei Makarov"]
16
- gem.email = ["andrei@kiskolabs.com"]
17
- gem.homepage = repository_url
18
- gem.summary = %q{An OmniAuth strategy for implementing Sign-in with Slack using OpenID Connect}
13
+ gem.email = ["contact@kiskolabs.com"]
14
+ gem.homepage = "https://github.com/amkisko/omniauth-slack-openid.rb"
15
+ gem.summary = "An OmniAuth strategy for implementing Sign-in with Slack using OpenID Connect"
19
16
  gem.description = gem.summary
20
17
  gem.metadata = {
21
- "homepage" => repository_url,
22
- "source_code_uri" => repository_url,
23
- "bug_tracker_uri" => "#{repository_url}/issues",
24
- "changelog_uri" => "#{repository_url}/blob/main/CHANGELOG.md",
18
+ "homepage" => "https://github.com/amkisko/omniauth-slack-openid.rb",
19
+ "source_code_uri" => "https://github.com/amkisko/omniauth-slack-openid.rb",
20
+ "bug_tracker_uri" => "https://github.com/amkisko/omniauth-slack-openid.rb/issues",
21
+ "changelog_uri" => "https://github.com/amkisko/omniauth-slack-openid.rb/blob/main/CHANGELOG.md",
25
22
  "rubygems_mfa_required" => "true"
26
23
  }
27
24
 
28
- gem.executables = Dir.glob("bin/*").map{ |f| File.basename(f) }
29
- gem.files = Dir.glob("lib/**/*.rb") + Dir.glob("bin/**/*") + root_files
30
- gem.test_files = Dir.glob("spec/**/*_spec.rb")
25
+ gem.executables = Dir.glob("bin/*").map { |f| File.basename(f) }
26
+ gem.files = Dir.glob("lib/**/*.rb") + Dir.glob("bin/**/*") + Dir.glob("sig/**/*.rbs") + root_files
31
27
 
32
- gem.required_ruby_version = ">= 2.5.0"
28
+ gem.required_ruby_version = ">= 3.4"
33
29
  gem.require_paths = ["lib"]
34
30
 
35
- gem.add_runtime_dependency 'omniauth', '~> 2'
36
- gem.add_runtime_dependency 'omniauth-oauth2', '~> 1'
37
-
38
- gem.add_development_dependency 'bundler', '~> 2'
39
- gem.add_development_dependency 'rake', '~> 13'
40
- gem.add_development_dependency 'rspec', '~> 3'
41
- gem.add_development_dependency 'pry', '~> 0.14'
42
- gem.add_development_dependency 'simplecov', '~> 0.21'
43
- gem.add_development_dependency 'simplecov-cobertura', '~> 2'
31
+ gem.add_runtime_dependency "omniauth", "~> 2.0", ">= 2.3.1"
32
+ gem.add_runtime_dependency "omniauth-oauth2", "~> 1.8", ">= 1.10.1"
33
+ gem.add_runtime_dependency "oauth2", "~> 2.0", ">= 2.1.0"
34
+ gem.add_runtime_dependency "base64"
35
+
36
+ gem.add_development_dependency "rake", "~> 13"
37
+ gem.add_development_dependency "rspec", "~> 3"
38
+ gem.add_development_dependency "pry", "~> 0.15"
39
+ gem.add_development_dependency "polyrun", ">= 3.2.0"
40
+ gem.add_development_dependency "bundler-audit", "~> 0.9"
41
+ gem.add_development_dependency "bigdecimal"
42
+ gem.add_development_dependency "ostruct"
43
+ gem.add_development_dependency "tsort"
44
+ gem.add_development_dependency "standard", "~> 1.52"
45
+ gem.add_development_dependency "standard-custom", "~> 1.0"
46
+ gem.add_development_dependency "standard-performance", "~> 1.8"
47
+ gem.add_development_dependency "standard-rspec", "~> 0.3"
48
+ gem.add_development_dependency "rubocop-rspec", "~> 3.8"
49
+ gem.add_development_dependency "rubocop-thread_safety", "~> 0.7"
50
+ gem.add_development_dependency "appraisal", "~> 2"
51
+ gem.add_development_dependency "rbs", "~> 4"
44
52
  end
@@ -0,0 +1,6 @@
1
+ module OmniAuth
2
+ module SlackOpenid
3
+ VERSION: String
4
+ end
5
+ end
6
+
@@ -0,0 +1,50 @@
1
+ module OmniAuth
2
+ module Strategies
3
+ class SlackOpenid < OmniAuth::Strategies::OAuth2
4
+ AUTH_OPTIONS: Array[Symbol]
5
+ USER_INFO_PATH: String
6
+
7
+ class INFO_DATA < Struct
8
+ attr_reader user_id: String?
9
+ attr_reader team_id: String?
10
+ attr_reader email: String?
11
+ attr_reader email_verified: bool?
12
+ attr_reader name: String?
13
+ attr_reader picture: String?
14
+ attr_reader given_name: String?
15
+ attr_reader family_name: String?
16
+ attr_reader locale: String?
17
+ attr_reader team_name: String?
18
+ attr_reader team_domain: String?
19
+
20
+ def initialize: (
21
+ ?user_id: String?,
22
+ ?team_id: String?,
23
+ ?email: String?,
24
+ ?email_verified: bool?,
25
+ ?name: String?,
26
+ ?picture: String?,
27
+ ?given_name: String?,
28
+ ?family_name: String?,
29
+ ?locale: String?,
30
+ ?team_name: String?,
31
+ ?team_domain: String?
32
+ ) -> void
33
+ end
34
+
35
+ def self.generate_uid: (String? team_id, String? user_id) -> String
36
+
37
+ def authorize_params: () -> Hash[Symbol, untyped]
38
+
39
+ def callback_url: () -> String
40
+
41
+ def raw_info: () -> Hash[String, untyped]
42
+
43
+ private
44
+
45
+ def fetch_and_validate_user_info: () -> Hash[String, untyped]
46
+
47
+ def valid_identifier?: (untyped value) -> bool
48
+ end
49
+ end
50
+ end
data/sig/omniauth.rbs ADDED
@@ -0,0 +1,3 @@
1
+ # Type signatures for OmniAuth::SlackOpenid
2
+ # See individual files in sig/omniauth/ for detailed signatures
3
+
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-slack-openid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-08-30 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
@@ -16,42 +15,74 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '2'
18
+ version: '2.0'
19
+ - - ">="
20
+ - !ruby/object:Gem::Version
21
+ version: 2.3.1
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
26
  - - "~>"
25
27
  - !ruby/object:Gem::Version
26
- version: '2'
28
+ version: '2.0'
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 2.3.1
27
32
  - !ruby/object:Gem::Dependency
28
33
  name: omniauth-oauth2
29
34
  requirement: !ruby/object:Gem::Requirement
30
35
  requirements:
31
36
  - - "~>"
32
37
  - !ruby/object:Gem::Version
33
- version: '1'
38
+ version: '1.8'
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 1.10.1
34
42
  type: :runtime
35
43
  prerelease: false
36
44
  version_requirements: !ruby/object:Gem::Requirement
37
45
  requirements:
38
46
  - - "~>"
39
47
  - !ruby/object:Gem::Version
40
- version: '1'
48
+ version: '1.8'
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: 1.10.1
41
52
  - !ruby/object:Gem::Dependency
42
- name: bundler
53
+ name: oauth2
43
54
  requirement: !ruby/object:Gem::Requirement
44
55
  requirements:
45
56
  - - "~>"
46
57
  - !ruby/object:Gem::Version
47
- version: '2'
48
- type: :development
58
+ version: '2.0'
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 2.1.0
62
+ type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '2'
68
+ version: '2.0'
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 2.1.0
72
+ - !ruby/object:Gem::Dependency
73
+ name: base64
74
+ requirement: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ type: :runtime
80
+ prerelease: false
81
+ version_requirements: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
55
86
  - !ruby/object:Gem::Dependency
56
87
  name: rake
57
88
  requirement: !ruby/object:Gem::Requirement
@@ -86,30 +117,170 @@ dependencies:
86
117
  requirements:
87
118
  - - "~>"
88
119
  - !ruby/object:Gem::Version
89
- version: '0.14'
120
+ version: '0.15'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: '0.15'
128
+ - !ruby/object:Gem::Dependency
129
+ name: polyrun
130
+ requirement: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: 3.2.0
135
+ type: :development
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: 3.2.0
142
+ - !ruby/object:Gem::Dependency
143
+ name: bundler-audit
144
+ requirement: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - "~>"
147
+ - !ruby/object:Gem::Version
148
+ version: '0.9'
149
+ type: :development
150
+ prerelease: false
151
+ version_requirements: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - "~>"
154
+ - !ruby/object:Gem::Version
155
+ version: '0.9'
156
+ - !ruby/object:Gem::Dependency
157
+ name: bigdecimal
158
+ requirement: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ type: :development
164
+ prerelease: false
165
+ version_requirements: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ - !ruby/object:Gem::Dependency
171
+ name: ostruct
172
+ requirement: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ type: :development
178
+ prerelease: false
179
+ version_requirements: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ version: '0'
184
+ - !ruby/object:Gem::Dependency
185
+ name: tsort
186
+ requirement: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: '0'
191
+ type: :development
192
+ prerelease: false
193
+ version_requirements: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ - !ruby/object:Gem::Dependency
199
+ name: standard
200
+ requirement: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - "~>"
203
+ - !ruby/object:Gem::Version
204
+ version: '1.52'
205
+ type: :development
206
+ prerelease: false
207
+ version_requirements: !ruby/object:Gem::Requirement
208
+ requirements:
209
+ - - "~>"
210
+ - !ruby/object:Gem::Version
211
+ version: '1.52'
212
+ - !ruby/object:Gem::Dependency
213
+ name: standard-custom
214
+ requirement: !ruby/object:Gem::Requirement
215
+ requirements:
216
+ - - "~>"
217
+ - !ruby/object:Gem::Version
218
+ version: '1.0'
219
+ type: :development
220
+ prerelease: false
221
+ version_requirements: !ruby/object:Gem::Requirement
222
+ requirements:
223
+ - - "~>"
224
+ - !ruby/object:Gem::Version
225
+ version: '1.0'
226
+ - !ruby/object:Gem::Dependency
227
+ name: standard-performance
228
+ requirement: !ruby/object:Gem::Requirement
229
+ requirements:
230
+ - - "~>"
231
+ - !ruby/object:Gem::Version
232
+ version: '1.8'
90
233
  type: :development
91
234
  prerelease: false
92
235
  version_requirements: !ruby/object:Gem::Requirement
93
236
  requirements:
94
237
  - - "~>"
95
238
  - !ruby/object:Gem::Version
96
- version: '0.14'
239
+ version: '1.8'
97
240
  - !ruby/object:Gem::Dependency
98
- name: simplecov
241
+ name: standard-rspec
99
242
  requirement: !ruby/object:Gem::Requirement
100
243
  requirements:
101
244
  - - "~>"
102
245
  - !ruby/object:Gem::Version
103
- version: '0.21'
246
+ version: '0.3'
104
247
  type: :development
105
248
  prerelease: false
106
249
  version_requirements: !ruby/object:Gem::Requirement
107
250
  requirements:
108
251
  - - "~>"
109
252
  - !ruby/object:Gem::Version
110
- version: '0.21'
253
+ version: '0.3'
111
254
  - !ruby/object:Gem::Dependency
112
- name: simplecov-cobertura
255
+ name: rubocop-rspec
256
+ requirement: !ruby/object:Gem::Requirement
257
+ requirements:
258
+ - - "~>"
259
+ - !ruby/object:Gem::Version
260
+ version: '3.8'
261
+ type: :development
262
+ prerelease: false
263
+ version_requirements: !ruby/object:Gem::Requirement
264
+ requirements:
265
+ - - "~>"
266
+ - !ruby/object:Gem::Version
267
+ version: '3.8'
268
+ - !ruby/object:Gem::Dependency
269
+ name: rubocop-thread_safety
270
+ requirement: !ruby/object:Gem::Requirement
271
+ requirements:
272
+ - - "~>"
273
+ - !ruby/object:Gem::Version
274
+ version: '0.7'
275
+ type: :development
276
+ prerelease: false
277
+ version_requirements: !ruby/object:Gem::Requirement
278
+ requirements:
279
+ - - "~>"
280
+ - !ruby/object:Gem::Version
281
+ version: '0.7'
282
+ - !ruby/object:Gem::Dependency
283
+ name: appraisal
113
284
  requirement: !ruby/object:Gem::Requirement
114
285
  requirements:
115
286
  - - "~>"
@@ -122,10 +293,24 @@ dependencies:
122
293
  - - "~>"
123
294
  - !ruby/object:Gem::Version
124
295
  version: '2'
296
+ - !ruby/object:Gem::Dependency
297
+ name: rbs
298
+ requirement: !ruby/object:Gem::Requirement
299
+ requirements:
300
+ - - "~>"
301
+ - !ruby/object:Gem::Version
302
+ version: '4'
303
+ type: :development
304
+ prerelease: false
305
+ version_requirements: !ruby/object:Gem::Requirement
306
+ requirements:
307
+ - - "~>"
308
+ - !ruby/object:Gem::Version
309
+ version: '4'
125
310
  description: An OmniAuth strategy for implementing Sign-in with Slack using OpenID
126
311
  Connect
127
312
  email:
128
- - andrei@kiskolabs.com
313
+ - contact@kiskolabs.com
129
314
  executables: []
130
315
  extensions: []
131
316
  extra_rdoc_files: []
@@ -137,7 +322,9 @@ files:
137
322
  - lib/omniauth/slack_openid.rb
138
323
  - lib/omniauth/strategies/slack_openid.rb
139
324
  - omniauth-slack-openid.gemspec
140
- - spec/omniauth/strategies/slack_openid_spec.rb
325
+ - sig/omniauth.rbs
326
+ - sig/omniauth/slack_openid.rbs
327
+ - sig/omniauth/strategies/slack_openid.rbs
141
328
  homepage: https://github.com/amkisko/omniauth-slack-openid.rb
142
329
  licenses:
143
330
  - MIT
@@ -147,7 +334,6 @@ metadata:
147
334
  bug_tracker_uri: https://github.com/amkisko/omniauth-slack-openid.rb/issues
148
335
  changelog_uri: https://github.com/amkisko/omniauth-slack-openid.rb/blob/main/CHANGELOG.md
149
336
  rubygems_mfa_required: 'true'
150
- post_install_message:
151
337
  rdoc_options: []
152
338
  require_paths:
153
339
  - lib
@@ -155,16 +341,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
341
  requirements:
156
342
  - - ">="
157
343
  - !ruby/object:Gem::Version
158
- version: 2.5.0
344
+ version: '3.4'
159
345
  required_rubygems_version: !ruby/object:Gem::Requirement
160
346
  requirements:
161
347
  - - ">="
162
348
  - !ruby/object:Gem::Version
163
349
  version: '0'
164
350
  requirements: []
165
- rubygems_version: 3.4.19
166
- signing_key:
351
+ rubygems_version: 4.0.6
167
352
  specification_version: 4
168
353
  summary: An OmniAuth strategy for implementing Sign-in with Slack using OpenID Connect
169
- test_files:
170
- - spec/omniauth/strategies/slack_openid_spec.rb
354
+ test_files: []
@@ -1,71 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe OmniAuth::Strategies::SlackOpenid do
4
- let(:user_name) { 'brent' }
5
- let(:user_email) { 'bront@slack-corp.com' }
6
- let(:raw_info) {
7
- {
8
- "ok" => true,
9
- "sub" => "U0R7JM",
10
- "https://slack.com/user_id" => "U0R7JM",
11
- "https://slack.com/team_id" => "T0R7GR",
12
- "email" => user_email,
13
- "email_verified" => true,
14
- "date_email_verified" => 1622128723,
15
- "name" => user_name,
16
- "picture" => "https://secure.gravatar.com/....png",
17
- "given_name" => "Bront",
18
- "family_name" => "Labradoodle",
19
- "locale" => "en-US",
20
- "https://slack.com/team_name" => "kraneflannel",
21
- "https://slack.com/team_domain" => "kraneflannel",
22
- "https://slack.com/user_image_24" => "...",
23
- "https://slack.com/user_image_32" => "...",
24
- "https://slack.com/user_image_48" => "...",
25
- "https://slack.com/user_image_72" => "...",
26
- "https://slack.com/user_image_192" => "...",
27
- "https://slack.com/user_image_512" => "...",
28
- "https://slack.com/team_image_34" => "...",
29
- "https://slack.com/team_image_44" => "...",
30
- "https://slack.com/team_image_68" => "...",
31
- "https://slack.com/team_image_88" => "...",
32
- "https://slack.com/team_image_102" => "...",
33
- "https://slack.com/team_image_132" => "...",
34
- "https://slack.com/team_image_230" => "...",
35
- "https://slack.com/team_image_default" => true
36
- }
37
- }
38
- let(:dummy_rack_app) { [200, {}, ['dummy']] }
39
- let(:options) { {} }
40
-
41
- subject(:strategy) { OmniAuth::Strategies::SlackOpenid.new(dummy_rack_app, options) }
42
-
43
- describe 'options' do
44
- subject { strategy.options }
45
-
46
- it { expect(subject.client_options.site).to eq('https://slack.com') }
47
- it { expect(subject.client_options.authorize_url).to eq('/openid/connect/authorize') }
48
- it { expect(subject.client_options.token_url).to eq('/api/openid.connect.token') }
49
- end
50
-
51
- describe '#info' do
52
- before do
53
- allow(strategy).to receive(:raw_info) { raw_info }
54
- end
55
-
56
- subject { strategy.info }
57
-
58
- it { expect(subject[:name]).to eq(user_name) }
59
- it { expect(subject[:email]).to eq(user_email) }
60
- end
61
-
62
- describe '#uid' do
63
- before do
64
- allow(strategy).to receive(:raw_info) { raw_info }
65
- end
66
-
67
- subject { strategy.uid }
68
-
69
- it { expect(subject).to eq('T0R7GR-U0R7JM') }
70
- end
71
- end