class Doorkeeper::Config
define it.
that returns configuration Builder class. This exception raises when they don’t
configurations. To use the Option DSL gems need to define ‘builder_class` method
Doorkeeper option DSL could be reused in extensions to build their own
def access_grant_model
-
(ActiveRecord::Base, Mongoid::Document, Sequel::Model)-
def access_grant_model @access_grant_model ||= access_grant_class.constantize end
def access_token_methods
def access_token_methods @access_token_methods ||= %i[ from_bearer_authorization from_access_token_param from_bearer_param ] end
def access_token_model
-
(ActiveRecord::Base, Mongoid::Document, Sequel::Model)-
def access_token_model @access_token_model ||= access_token_class.constantize end
def allow_blank_redirect_uri?(application = nil)
def allow_blank_redirect_uri?(application = nil) if allow_blank_redirect_uri.respond_to?(:call) allow_blank_redirect_uri.call(grant_flows, application) else allow_blank_redirect_uri end end
def allow_grant_flow_for_client?(grant_flow, client)
def allow_grant_flow_for_client?(grant_flow, client) return true unless option_defined?(:allow_grant_flow_for_client) allow_grant_flow_for_client.call(grant_flow, client) end
def api_only
def api_only @api_only ||= false end
def application_model
-
(ActiveRecord::Base, Mongoid::Document, Sequel::Model)-
def application_model @application_model ||= application_class.constantize end
def application_secret_hashed?
def application_secret_hashed? instance_variable_defined?(:"@application_secret_strategy") end
def application_secret_strategy
def application_secret_strategy @application_secret_strategy ||= ::Doorkeeper::SecretStoring::Plain end
def authorization_response_flows
def authorization_response_flows @authorization_response_flows ||= enabled_grant_flows.select(&:handles_response_type?) + deprecated_authorization_flows end
def authorization_response_types
def authorization_response_types authorization_response_flows.map(&:response_type_matches) end
def calculate_authorization_response_types
def calculate_authorization_response_types [] end
def calculate_grant_flows
to single or multiple other flows.
configuration considering registered aliases that is exposed
Calculates grant flows configured by the user in Doorkeeper
def calculate_grant_flows configured_flows = grant_flows.map(&:to_s) aliases = Doorkeeper::GrantFlow.aliases.keys.map(&:to_s) flows = configured_flows - aliases aliases.each do |flow_alias| next unless configured_flows.include?(flow_alias) flows.concat(Doorkeeper::GrantFlow.expand_alias(flow_alias)) end flows.flatten.uniq end
def calculate_token_grant_flows
def calculate_token_grant_flows flows = enabled_grant_flows.select(&:handles_grant_type?) flows << Doorkeeper::GrantFlow.get("refresh_token") if refresh_token_enabled? flows end
def calculate_token_grant_types
def calculate_token_grant_types types = grant_flows - ["implicit"] types << "refresh_token" if refresh_token_enabled? types end
def clear_cache!
def clear_cache! %i[ application_model access_token_model access_grant_model ].each do |var| remove_instance_variable("@#{var}") if instance_variable_defined?("@#{var}") end end
def client_credentials_methods
def client_credentials_methods @client_credentials_methods ||= %i[from_basic from_params] end
def confirm_application_owner?
def confirm_application_owner? option_set? :confirm_application_owner end
def default_scopes
def default_scopes @default_scopes ||= OAuth::Scopes.new end
def deprecated_authorization_flows
def deprecated_authorization_flows response_types = calculate_authorization_response_types if response_types.any? ::Kernel.warn <<~WARNING Please, don't patch Doorkeeper::Config#calculate_authorization_response_types method. Register your custom grant flows using the public API: `Doorkeeper::GrantFlow.register(grant_flow_name, **options)`. WARNING end response_types.map do |response_type| Doorkeeper::GrantFlow::FallbackFlow.new(response_type, response_type_matches: response_type) end end
def deprecated_token_grant_types_resolver
def deprecated_token_grant_types_resolver @deprecated_token_grant_types ||= calculate_token_grant_types end
def dynamic_scopes_delimiter
def dynamic_scopes_delimiter @dynamic_scopes_delimiter end
def enable_application_owner?
def enable_application_owner? option_set? :enable_application_owner end
def enable_dynamic_scopes?
def enable_dynamic_scopes? option_set? :enable_dynamic_scopes end
def enabled_grant_flows
def enabled_grant_flows @enabled_grant_flows ||= calculate_grant_flows.map { |name| Doorkeeper::GrantFlow.get(name) }.compact end
def enforce_configured_scopes?
def enforce_configured_scopes? option_set? :enforce_configured_scopes end
def enforce_content_type
def enforce_content_type @enforce_content_type ||= false end
def force_pkce?
def force_pkce? option_set? :force_pkce end
def native_authorization_code_route
def native_authorization_code_route @use_url_path_for_native_authorization = false unless defined?(@use_url_path_for_native_authorization) @use_url_path_for_native_authorization ? '/:code' : '/native' end
def option_defined?(name)
def option_defined?(name) instance_variable_defined?("@#{name}") end
def option_set?(instance_key)
def option_set?(instance_key) var = instance_variable_get("@#{instance_key}") !!(defined?(var) && var) end
def optional_scopes
def optional_scopes @optional_scopes ||= OAuth::Scopes.new end
def pkce_code_challenge_methods_supported
def pkce_code_challenge_methods_supported return [] unless access_grant_model.pkce_supported? pkce_code_challenge_methods end
def polymorphic_resource_owner?
def polymorphic_resource_owner? option_set? :polymorphic_resource_owner end
def raise_on_errors?
def raise_on_errors? handle_auth_errors == :raise end
def redirect_on_errors?
def redirect_on_errors? handle_auth_errors == :redirect end
def refresh_token_enabled?
def refresh_token_enabled? if defined?(@refresh_token_enabled) @refresh_token_enabled else false end end
def resolve_controller(name)
def resolve_controller(name) config_option = public_send(:"#{name}_controller") controller_name = if config_option.respond_to?(:call) instance_exec(&config_option) else config_option end controller_name.constantize end
def revoke_previous_authorization_code_token?
def revoke_previous_authorization_code_token? option_set? :revoke_previous_authorization_code_token end
def revoke_previous_client_credentials_token?
def revoke_previous_client_credentials_token? option_set? :revoke_previous_client_credentials_token end
def scopes
def scopes @scopes ||= default_scopes + optional_scopes end
def scopes_by_grant_type
def scopes_by_grant_type @scopes_by_grant_type ||= {} end
def token_grant_flows
def token_grant_flows @token_grant_flows ||= calculate_token_grant_flows end
def token_grant_types
def token_grant_types token_grant_flows.map(&:grant_type_matches) end
def token_secret_strategy
def token_secret_strategy @token_secret_strategy ||= ::Doorkeeper::SecretStoring::Plain end