lib/rodauth/features/oauth.rb in rodauth-oauth-0.5.1 vs lib/rodauth/features/oauth.rb in rodauth-oauth-0.6.0
- old
+ new
@@ -7,11 +7,11 @@
require "rodauth/oauth/ttl_store"
require "rodauth/oauth/database_extensions"
module Rodauth
- Feature.define(:oauth) do
+ Feature.define(:oauth, :Oauth) do
# RUBY EXTENSIONS
unless Regexp.method_defined?(:match?)
# If you wonder why this is there: the oauth feature uses a refinement to enhance the
# Regexp class locally with #match? , but this is never tested, because ActiveSupport
# monkey-patches the same method... Please ActiveSupport, stop being so intrusive!
@@ -464,14 +464,10 @@
@json_request = request.content_type =~ json_request_regexp
end
end
- def initialize(scope)
- @scope = scope
- end
-
def scopes
scope = request.params["scope"]
case scope
when Array
scope
@@ -566,15 +562,14 @@
return unless is_authorization_server?
self.class.__send__(:include, Rodauth::OAuth::ExtendDatabase(db))
# Check whether we can reutilize db entries for the same account / application pair
- one_oauth_token_per_account = begin
- db.indexes(oauth_tokens_table).values.any? do |definition|
- definition[:unique] &&
- definition[:columns] == oauth_tokens_unique_columns
- end
+ one_oauth_token_per_account = db.indexes(oauth_tokens_table).values.any? do |definition|
+ definition[:unique] &&
+ definition[:columns] == oauth_tokens_unique_columns
end
+
self.class.send(:define_method, :__one_oauth_token_per_account) { one_oauth_token_per_account }
end
def use_date_arithmetic?
true