lib/doorkeeper/oauth/authorization/token.rb in doorkeeper-5.1.0.rc2 vs lib/doorkeeper/oauth/authorization/token.rb in doorkeeper-5.1.0
- old
+ new
@@ -21,15 +21,18 @@
grant_type,
scopes
)
end
- def access_token_expires_in(server, context)
- if (expiration = server.custom_access_token_expires_in.call(context))
- expiration
+ def access_token_expires_in(configuration, context)
+ if configuration.option_defined?(:custom_access_token_expires_in)
+ expiration = configuration.custom_access_token_expires_in.call(context)
+ return nil if expiration == Float::INFINITY
+
+ expiration || configuration.access_token_expires_in
else
- server.access_token_expires_in
+ configuration.access_token_expires_in
end
end
def refresh_token_enabled?(server, context)
if server.refresh_token_enabled?.respond_to? :call
@@ -62,11 +65,11 @@
def native_redirect
{
controller: controller,
action: :show,
- access_token: token.plaintext_token
+ access_token: token.plaintext_token,
}
end
private
@@ -75,10 +78,10 @@
end
def controller
@controller ||= begin
mapping = Doorkeeper::Rails::Routes.mapping[:token_info] || {}
- mapping[:controllers] || 'doorkeeper/token_info'
+ mapping[:controllers] || "doorkeeper/token_info"
end
end
end
end
end