lib/rodauth/features/oauth_resource_indicators.rb in rodauth-oauth-0.10.2 vs lib/rodauth/features/oauth_resource_indicators.rb in rodauth-oauth-0.10.3
- old
+ new
@@ -1,13 +1,13 @@
-# frozen-string-literal: true
+# frozen_string_literal: true
require "rodauth/oauth/version"
require "rodauth/oauth/ttl_store"
module Rodauth
Feature.define(:oauth_resource_indicators, :OauthResourceIndicators) do
- depends :oauth_base
+ depends :oauth_authorize_base
auth_value_method :oauth_grants_resource_column, :resource
auth_value_method :oauth_tokens_resource_column, :resource
def resource_indicators
@@ -78,31 +78,31 @@
end
module IndicatorAuthorizationCodeGrant
private
- def validate_oauth_grant_params
+ def validate_authorize_params
super
return unless resource_indicators
resource_indicators.each do |resource|
redirect_response_error("invalid_target") unless check_valid_no_fragment_uri?(resource)
end
end
- def create_oauth_token_from_authorization_code(oauth_grant, create_params)
+ def create_oauth_token_from_authorization_code(oauth_grant, create_params, *args)
return super unless resource_indicators
redirect_response_error("invalid_target") unless oauth_grant[oauth_grants_resource_column]
grant_indicators = oauth_grant[oauth_grants_resource_column]
grant_indicators = grant_indicators.split(" ") if grant_indicators.is_a?(String)
redirect_response_error("invalid_target") unless (grant_indicators - resource_indicators) != grant_indicators
- super(oauth_grant, create_params.merge(oauth_tokens_resource_column => resource_indicators))
+ super(oauth_grant, create_params.merge(oauth_tokens_resource_column => resource_indicators), *args)
end
def create_oauth_grant(create_params = {})
create_params[oauth_grants_resource_column] = resource_indicators.join(" ") if resource_indicators