File: grant_flow.rb

package info (click to toggle)
ruby-doorkeeper 5.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 992 kB
  • sloc: ruby: 4,644; makefile: 4
file content (45 lines) | stat: -rw-r--r-- 1,171 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# frozen_string_literal: true

require "doorkeeper/grant_flow/flow"
require "doorkeeper/grant_flow/fallback_flow"
require "doorkeeper/grant_flow/registry"

module Doorkeeper
  module GrantFlow
    extend Registry

    register(
      :implicit,
      response_type_matches: "token",
      response_mode_matches: %w[fragment form_post],
      response_type_strategy: Doorkeeper::Request::Token,
    )

    register(
      :authorization_code,
      response_type_matches: "code",
      response_mode_matches: %w[query fragment form_post],
      response_type_strategy: Doorkeeper::Request::Code,
      grant_type_matches: "authorization_code",
      grant_type_strategy: Doorkeeper::Request::AuthorizationCode,
    )

    register(
      :client_credentials,
      grant_type_matches: "client_credentials",
      grant_type_strategy: Doorkeeper::Request::ClientCredentials,
    )

    register(
      :password,
      grant_type_matches: "password",
      grant_type_strategy: Doorkeeper::Request::Password,
    )

    register(
      :refresh_token,
      grant_type_matches: "refresh_token",
      grant_type_strategy: Doorkeeper::Request::RefreshToken,
    )
  end
end