module Doorkeeper::GrantFlow::Registry
Public Instance Methods
expand_alias(alias_name)
click to toggle source
# File lib/doorkeeper/grant_flow/registry.rb, line 40 def expand_alias(alias_name) aliases.fetch(alias_name.to_sym, []) end
get(name)
click to toggle source
[NOTE]: make it to use fetch after removing fallbacks
# File lib/doorkeeper/grant_flow/registry.rb, line 45 def get(name) flows[name.to_sym] end
register(name_or_flow, **options)
click to toggle source
Allows to register custom OAuth
grant flow so that Doorkeeper
could recognize and process it.
# File lib/doorkeeper/grant_flow/registry.rb, line 15 def register(name_or_flow, **options) unless name_or_flow.is_a?(Doorkeeper::GrantFlow::Flow) name_or_flow = Flow.new(name_or_flow, **options) end flow_key = name_or_flow.name.to_sym if flows.key?(flow_key) ::Kernel.warn <<~WARNING [DOORKEEPER] '#{flow_key}' grant flow already registered and will be overridden in #{caller(1..1).first} WARNING end flows[flow_key] = name_or_flow end
register_alias(alias_name, **options)
click to toggle source
Allows to register aliases that could be used in ‘grant_flows` configuration option. It is possible to have aliases like 1:1 or 1:N, i.e. “implicit_oidc” => [’token’, ‘id_token’, ‘id_token token’].
# File lib/doorkeeper/grant_flow/registry.rb, line 36 def register_alias(alias_name, **options) aliases[alias_name.to_sym] = Array.wrap(options.fetch(:as)) end