Skip to content

Commit

Permalink
update dependencies for rack and openid_connect (#5)
Browse files Browse the repository at this point in the history
Replace openid_connect with forked version to remove version
dependencies
  • Loading branch information
msuliq authored Jul 21, 2024
1 parent aded791 commit 141dc34
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## [Released]

## [0.2.0] - 2024-07-21
- Update dependencies

## [0.2.0] - 2024-07-06
- Add option to fetch user info or skip it

Expand Down
2 changes: 1 addition & 1 deletion lib/omniauth/oidc/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module OmniauthOidc
VERSION = "0.2.0"
VERSION = "0.2.1"
end
6 changes: 3 additions & 3 deletions lib/omniauth/strategies/oidc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require "net/http"
require "open-uri"
require "omniauth"
require "openid_connect"
require "oidc"
require "openid_config_parser"
require "forwardable"
require "httparty"
Expand Down Expand Up @@ -112,9 +112,9 @@ def uid
}
end

# Initialize OpenIDConnect Client with options
# Initialize Oidc Client with options
def client
@client ||= ::OpenIDConnect::Client.new(client_options)
@client ||= ::Oidc::Client.new(client_options)
end

# Config is build from the json response from the OIDC config endpoint
Expand Down
9 changes: 4 additions & 5 deletions lib/omniauth/strategies/oidc/verify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def public_key
private

def fetch_key
@fetch_key ||= parse_jwk_key(::OpenIDConnect.http_client.get(config.jwks_uri).body)
@fetch_key ||= parse_jwk_key(::Oidc.http_client.get(config.jwks_uri).body)
end

def base64_decoded_jwt_secret
Expand All @@ -47,7 +47,6 @@ def verify_id_token!(id_token)
nonce: params["nonce"].presence || stored_nonce)
end

# Workaround for https://github.com/nov/openid_connect/issues/61
def decode_id_token(id_token)
decoded = JSON::JWT.decode(id_token, :skip_verification)
algorithm = decoded.algorithm.to_sym
Expand All @@ -63,7 +62,7 @@ def decode_id_token(id_token)
end

decoded.verify!(keyset)
::OpenIDConnect::ResponseObject::IdToken.new(decoded)
::Oidc::ResponseObject::IdToken.new(decoded)
rescue JSON::JWK::Set::KidNotFound
# Workaround for https://github.com/nov/json-jwt/pull/92#issuecomment-824654949
raise if decoded&.header&.key?("kid")
Expand All @@ -88,7 +87,7 @@ def validate_client_algorithm!(algorithm)
end

def decode!(id_token, key)
::OpenIDConnect::ResponseObject::IdToken.decode(id_token, key)
::Oidc::ResponseObject::IdToken.decode(id_token, key)
end

def decode_with_each_key!(id_token, keyset)
Expand Down Expand Up @@ -140,7 +139,7 @@ def user_info
if access_token.id_token
decoded = decode_id_token(access_token.id_token).raw_attributes

@user_info = ::OpenIDConnect::ResponseObject::UserInfo.new(
@user_info = ::Oidc::ResponseObject::UserInfo.new(
access_token.userinfo!.raw_attributes.merge(decoded)
)
else
Expand Down
2 changes: 1 addition & 1 deletion omniauth_oidc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ Gem::Specification.new do |spec|

# Uncomment to register a new dependency of your gem
spec.add_dependency "httparty"
spec.add_dependency "oidc"
spec.add_dependency "omniauth"
spec.add_dependency "openid_config_parser"
spec.add_dependency "openid_connect"

# For more information and examples about making a new gem, check out our
# guide at: https://bundler.io/guides/creating_gem.html
Expand Down

0 comments on commit 141dc34

Please sign in to comment.