Module: Doorkeeper::GrantFlow::Registry
- Included in:
- Doorkeeper::GrantFlow
- Defined in:
- lib/doorkeeper/grant_flow/registry.rb
Instance Method Summary collapse
- #expand_alias(alias_name) ⇒ Object
-
#get(name) ⇒ Object
[NOTE]: make it to use #fetch after removing fallbacks.
-
#register(name_or_flow, **options) ⇒ Object
Allows to register custom OAuth grant flow so that Doorkeeper could recognize and process it.
-
#register_alias(alias_name, **options) ⇒ Object
Allows to register aliases that could be used in ‘grant_flows` configuration option.
Instance Method Details
#expand_alias(alias_name) ⇒ Object
40 41 42 |
# File 'lib/doorkeeper/grant_flow/registry.rb', line 40 def (alias_name) aliases.fetch(alias_name.to_sym, []) end |
#get(name) ⇒ Object
[NOTE]: make it to use #fetch after removing fallbacks
45 46 47 |
# File 'lib/doorkeeper/grant_flow/registry.rb', line 45 def get(name) flows[name.to_sym] end |
#register(name_or_flow, **options) ⇒ Object
Allows to register custom OAuth grant flow so that Doorkeeper could recognize and process it.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/doorkeeper/grant_flow/registry.rb', line 15 def register(name_or_flow, **) unless name_or_flow.is_a?(Doorkeeper::GrantFlow::Flow) name_or_flow = Flow.new(name_or_flow, **) 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) ⇒ Object
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’].
36 37 38 |
# File 'lib/doorkeeper/grant_flow/registry.rb', line 36 def register_alias(alias_name, **) aliases[alias_name.to_sym] = Array.wrap(.fetch(:as)) end |