Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SHD-1009] Use dynamic options #46

Merged
merged 4 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

* Use dynamic issuer for JWK discovery and token introspection

## [1.3.3] - 2024-07-01

### Fixed

* Correct URLs for JWK discovery and token introspection. PR [#43](https://github.com/powerhome/omniauth-nitro-id/pull/43)

## [1.3.2] - 2024-06-30

### Fixed

* Correct default issuer value for nitro-id and tempo-id strategies. PR [#41](https://github.com/powerhome/omniauth-nitro-id/pull/41)

## [1.3.1] - 2023-09-21

* Display better error message for missing credentials. PR [#27](https://github.com/powerhome/omniauth-nitro-id/pull/27)
Expand Down Expand Up @@ -47,7 +63,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* Initial release

[Unreleased]: https://github.com/powerhome/omniauth-nitro-id/compare/v1.3.1...HEAD
[Unreleased]: https://github.com/powerhome/omniauth-nitro-id/compare/v1.3.3...HEAD
[1.3.3]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.3.3
[1.3.2]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.3.2
[1.3.1]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.3.1
[1.3.0]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.3.0
[1.2.1]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.2.1
Expand Down
6 changes: 3 additions & 3 deletions lib/omniauth/strategies/base_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def self.decode_logout_token(token)
end

def self.fetch_jwks
key = ::OpenIDConnect.http_client.get("#{default_options[:issuer]}/.well-known/jwks.json").body
key = ::OpenIDConnect.http_client.get("#{options[:issuer]}/.well-known/jwks.json").body
json = key.is_a?(String) ? JSON.parse(key) : key
return JSON::JWK::Set.new(json["keys"]) if json.key?("keys")

Expand All @@ -45,9 +45,9 @@ def self.introspect_token(token, api_key)
body: { token: token },
}

response = ::OpenIDConnect.http_client.post("#{default_options[:issuer]}/api/tokens/introspect", **options)
response = ::OpenIDConnect.http_client.post("#{options[:issuer]}/api/tokens/introspect", **options)

raise APIError, "#{default_options[:name]} error: #{response.status}" if response.status.to_i >= 400
raise APIError, "#{options[:name]} error: #{response.status}" if response.status.to_i >= 400

JSON.parse(response.body)
end
Expand Down
Loading