oauth2 1.4.7 → 2.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +811 -76
- data/CITATION.cff +20 -0
- data/CODE_OF_CONDUCT.md +24 -23
- data/CONTRIBUTING.md +221 -0
- data/FUNDING.md +74 -0
- data/IRP.md +107 -0
- data/{LICENSE → LICENSE.txt} +2 -2
- data/OIDC.md +167 -0
- data/README.md +1468 -166
- data/REEK +2 -0
- data/RUBOCOP.md +71 -0
- data/SECURITY.md +24 -0
- data/THREAT_MODEL.md +94 -0
- data/lib/oauth2/access_token.rb +276 -40
- data/lib/oauth2/auth_sanitizer.rb +36 -0
- data/lib/oauth2/authenticator.rb +51 -10
- data/lib/oauth2/client.rb +444 -124
- data/lib/oauth2/error.rb +63 -24
- data/lib/oauth2/filtered_attributes.rb +10 -0
- data/lib/oauth2/response.rb +138 -43
- data/lib/oauth2/strategy/assertion.rb +71 -41
- data/lib/oauth2/strategy/auth_code.rb +28 -5
- data/lib/oauth2/strategy/base.rb +2 -0
- data/lib/oauth2/strategy/client_credentials.rb +6 -4
- data/lib/oauth2/strategy/implicit.rb +20 -3
- data/lib/oauth2/strategy/password.rb +17 -5
- data/lib/oauth2/version.rb +2 -59
- data/lib/oauth2.rb +103 -12
- data/sig/oauth2/access_token.rbs +25 -0
- data/sig/oauth2/authenticator.rbs +22 -0
- data/sig/oauth2/client.rbs +52 -0
- data/sig/oauth2/error.rbs +8 -0
- data/sig/oauth2/filtered_attributes.rbs +11 -0
- data/sig/oauth2/response.rbs +18 -0
- data/sig/oauth2/sanitized_logger.rbs +32 -0
- data/sig/oauth2/strategy.rbs +34 -0
- data/sig/oauth2/thing_filter.rbs +10 -0
- data/sig/oauth2/version.rbs +5 -0
- data/sig/oauth2.rbs +9 -0
- data.tar.gz.sig +0 -0
- metadata +293 -102
- metadata.gz.sig +4 -0
- data/lib/oauth2/mac_token.rb +0 -130
- data/spec/helper.rb +0 -37
- data/spec/oauth2/access_token_spec.rb +0 -216
- data/spec/oauth2/authenticator_spec.rb +0 -84
- data/spec/oauth2/client_spec.rb +0 -506
- data/spec/oauth2/mac_token_spec.rb +0 -117
- data/spec/oauth2/response_spec.rb +0 -90
- data/spec/oauth2/strategy/assertion_spec.rb +0 -58
- data/spec/oauth2/strategy/auth_code_spec.rb +0 -107
- data/spec/oauth2/strategy/base_spec.rb +0 -5
- data/spec/oauth2/strategy/client_credentials_spec.rb +0 -69
- data/spec/oauth2/strategy/implicit_spec.rb +0 -26
- data/spec/oauth2/strategy/password_spec.rb +0 -55
- data/spec/oauth2/version_spec.rb +0 -23
|
@@ -1,14 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module OAuth2
|
|
2
4
|
module Strategy
|
|
3
5
|
# The Resource Owner Password Credentials Authorization Strategy
|
|
4
6
|
#
|
|
5
|
-
#
|
|
7
|
+
# IMPORTANT (OAuth 2.1): The Resource Owner Password Credentials grant is omitted in OAuth 2.1.
|
|
8
|
+
# It remains here for backward compatibility with OAuth 2.0 providers. Prefer Authorization Code + PKCE.
|
|
9
|
+
#
|
|
10
|
+
# References:
|
|
11
|
+
# - OAuth 2.1 draft: https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-13
|
|
12
|
+
# - Okta explainer: https://developer.okta.com/blog/2019/12/13/oauth-2-1-how-many-rfcs
|
|
13
|
+
# - FusionAuth blog: https://fusionauth.io/blog/2020/04/15/whats-new-in-oauth-2-1
|
|
14
|
+
#
|
|
15
|
+
# @see http://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-15#section-4.3
|
|
6
16
|
class Password < Base
|
|
7
17
|
# Not used for this strategy
|
|
8
18
|
#
|
|
9
19
|
# @raise [NotImplementedError]
|
|
10
20
|
def authorize_url
|
|
11
|
-
raise(NotImplementedError,
|
|
21
|
+
raise(NotImplementedError, "The authorization endpoint is not used in this strategy")
|
|
12
22
|
end
|
|
13
23
|
|
|
14
24
|
# Retrieve an access token given the specified End User username and password.
|
|
@@ -17,9 +27,11 @@ module OAuth2
|
|
|
17
27
|
# @param [String] password the End User password
|
|
18
28
|
# @param [Hash] params additional params
|
|
19
29
|
def get_token(username, password, params = {}, opts = {})
|
|
20
|
-
params = {
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
params = {
|
|
31
|
+
"grant_type" => "password",
|
|
32
|
+
"username" => username,
|
|
33
|
+
"password" => password,
|
|
34
|
+
}.merge(params)
|
|
23
35
|
@client.get_token(params, opts)
|
|
24
36
|
end
|
|
25
37
|
end
|
data/lib/oauth2/version.rb
CHANGED
|
@@ -2,64 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module OAuth2
|
|
4
4
|
module Version
|
|
5
|
-
VERSION =
|
|
6
|
-
|
|
7
|
-
module_function
|
|
8
|
-
|
|
9
|
-
# The major version
|
|
10
|
-
#
|
|
11
|
-
# @return [Integer]
|
|
12
|
-
def major
|
|
13
|
-
1
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# The minor version
|
|
17
|
-
#
|
|
18
|
-
# @return [Integer]
|
|
19
|
-
def minor
|
|
20
|
-
4
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# The patch version
|
|
24
|
-
#
|
|
25
|
-
# @return [Integer]
|
|
26
|
-
def patch
|
|
27
|
-
7
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# The pre-release version, if any
|
|
31
|
-
#
|
|
32
|
-
# @return [String, NilClass]
|
|
33
|
-
def pre
|
|
34
|
-
nil
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# The version number as a hash
|
|
38
|
-
#
|
|
39
|
-
# @return [Hash]
|
|
40
|
-
def to_h
|
|
41
|
-
{
|
|
42
|
-
:major => major,
|
|
43
|
-
:minor => minor,
|
|
44
|
-
:patch => patch,
|
|
45
|
-
:pre => pre,
|
|
46
|
-
}
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
# The version number as an array
|
|
50
|
-
#
|
|
51
|
-
# @return [Array]
|
|
52
|
-
def to_a
|
|
53
|
-
[major, minor, patch, pre].compact
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# The version number as a string
|
|
57
|
-
#
|
|
58
|
-
# @return [String]
|
|
59
|
-
def to_s
|
|
60
|
-
v = [major, minor, patch].compact.join('.')
|
|
61
|
-
v += "-#{pre}" if pre
|
|
62
|
-
v
|
|
63
|
-
end
|
|
5
|
+
VERSION = "2.0.20"
|
|
64
6
|
end
|
|
7
|
+
VERSION = Version::VERSION # Traditional Constant Location
|
|
65
8
|
end
|
data/lib/oauth2.rb
CHANGED
|
@@ -1,12 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
require
|
|
9
|
-
require
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# includes modules from stdlib
|
|
4
|
+
require "cgi/escape"
|
|
5
|
+
require "time"
|
|
6
|
+
|
|
7
|
+
# third party gems
|
|
8
|
+
require "snaky_hash"
|
|
9
|
+
require "version_gem"
|
|
10
|
+
|
|
11
|
+
# includes gem files
|
|
12
|
+
require_relative "oauth2/version"
|
|
13
|
+
require_relative "oauth2/auth_sanitizer"
|
|
14
|
+
require_relative "oauth2/filtered_attributes"
|
|
15
|
+
require_relative "oauth2/error"
|
|
16
|
+
require_relative "oauth2/authenticator"
|
|
17
|
+
require_relative "oauth2/client"
|
|
18
|
+
require_relative "oauth2/strategy/base"
|
|
19
|
+
require_relative "oauth2/strategy/auth_code"
|
|
20
|
+
require_relative "oauth2/strategy/implicit"
|
|
21
|
+
require_relative "oauth2/strategy/password"
|
|
22
|
+
require_relative "oauth2/strategy/client_credentials"
|
|
23
|
+
require_relative "oauth2/strategy/assertion"
|
|
24
|
+
require_relative "oauth2/access_token"
|
|
25
|
+
require_relative "oauth2/response"
|
|
26
|
+
|
|
27
|
+
# The namespace of this library
|
|
28
|
+
#
|
|
29
|
+
# This module is the entry point and top-level namespace for the oauth2 gem.
|
|
30
|
+
# It exposes configuration, constants, and requires the primary public classes.
|
|
31
|
+
module OAuth2
|
|
32
|
+
# When true, enables verbose HTTP logging via Faraday's logger middleware.
|
|
33
|
+
# Controlled by the OAUTH_DEBUG environment variable. Any case-insensitive
|
|
34
|
+
# value equal to "true" will enable debugging.
|
|
35
|
+
#
|
|
36
|
+
# @return [Boolean]
|
|
37
|
+
OAUTH_DEBUG = ENV.fetch("OAUTH_DEBUG", "false").casecmp("true").zero?
|
|
38
|
+
|
|
39
|
+
# Default configuration values for the oauth2 library.
|
|
40
|
+
#
|
|
41
|
+
# @example Toggle warnings
|
|
42
|
+
# OAuth2.configure do |config|
|
|
43
|
+
# config[:silence_extra_tokens_warning] = false
|
|
44
|
+
# config[:silence_no_tokens_warning] = false
|
|
45
|
+
# end
|
|
46
|
+
#
|
|
47
|
+
# @example Customize filtered output markers and debug-log value filtering by key name
|
|
48
|
+
# OAuth2.configure do |config|
|
|
49
|
+
# config[:filtered_label] = "[REDACTED]"
|
|
50
|
+
# config[:filtered_debug_keys] += ["client_assertion"]
|
|
51
|
+
# end
|
|
52
|
+
#
|
|
53
|
+
# Existing objects and logger wrappers snapshot filtering configuration during
|
|
54
|
+
# initialization. Changing these config values later affects only newly
|
|
55
|
+
# initialized objects and debug loggers.
|
|
56
|
+
#
|
|
57
|
+
# @return [SnakyHash::SymbolKeyed] A mutable Hash-like config with symbol keys
|
|
58
|
+
DEFAULT_CONFIG = SnakyHash::SymbolKeyed.new(
|
|
59
|
+
silence_extra_tokens_warning: true,
|
|
60
|
+
silence_no_tokens_warning: true,
|
|
61
|
+
filtered_label: "[FILTERED]",
|
|
62
|
+
filtered_debug_keys: %w[
|
|
63
|
+
access_token
|
|
64
|
+
refresh_token
|
|
65
|
+
id_token
|
|
66
|
+
client_secret
|
|
67
|
+
assertion
|
|
68
|
+
code_verifier
|
|
69
|
+
token
|
|
70
|
+
],
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# The current runtime configuration for the library.
|
|
74
|
+
#
|
|
75
|
+
# @return [SnakyHash::SymbolKeyed]
|
|
76
|
+
CONFIG = DEFAULT_CONFIG.dup
|
|
77
|
+
|
|
78
|
+
class << self
|
|
79
|
+
def config
|
|
80
|
+
CONFIG
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Configure global library behavior.
|
|
84
|
+
#
|
|
85
|
+
# Yields the mutable configuration object so callers can update settings.
|
|
86
|
+
#
|
|
87
|
+
# @yieldparam [SnakyHash::SymbolKeyed] config the configuration object
|
|
88
|
+
# @return [void]
|
|
89
|
+
def configure
|
|
90
|
+
yield config
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Wire OAuth2::AUTH_SANITIZER's label provider to read from OAuth2.config so that
|
|
96
|
+
# FilteredAttributes-bearing objects and OAuth2::AUTH_SANITIZER::SanitizedLogger instances
|
|
97
|
+
# pick up OAuth2.config[:filtered_label] at their initialization time.
|
|
98
|
+
OAuth2::AUTH_SANITIZER.filtered_label_provider = -> { OAuth2.config[:filtered_label] }
|
|
99
|
+
|
|
100
|
+
# Extend OAuth2::Version with VersionGem helpers to provide semantic version helpers.
|
|
101
|
+
OAuth2::Version.class_eval do
|
|
102
|
+
extend VersionGem::Basic
|
|
103
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module OAuth2
|
|
2
|
+
class AccessToken
|
|
3
|
+
def self.from_hash: (OAuth2::Client, Hash[untyped, untyped]) -> OAuth2::AccessToken
|
|
4
|
+
def self.from_kvform: (OAuth2::Client, String) -> OAuth2::AccessToken
|
|
5
|
+
|
|
6
|
+
def initialize: (OAuth2::Client, String, ?Hash[Symbol, untyped]) -> void
|
|
7
|
+
def []: (String | Symbol) -> untyped
|
|
8
|
+
def expires?: () -> bool
|
|
9
|
+
def expired?: () -> bool
|
|
10
|
+
def refresh: (?Hash[untyped, untyped], ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::AccessToken
|
|
11
|
+
def revoke: (?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
|
|
12
|
+
def to_hash: () -> Hash[Symbol, untyped]
|
|
13
|
+
def request: (Symbol, String, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
|
|
14
|
+
def get: (String, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
|
|
15
|
+
def post: (String, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
|
|
16
|
+
def put: (String, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
|
|
17
|
+
def patch: (String, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
|
|
18
|
+
def delete: (String, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
|
|
19
|
+
def headers: () -> Hash[String, String]
|
|
20
|
+
def configure_authentication!: (Hash[Symbol, untyped], Symbol) -> void
|
|
21
|
+
def convert_expires_at: (untyped) -> (Time | Integer | nil)
|
|
22
|
+
|
|
23
|
+
attr_accessor response: OAuth2::Response
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module OAuth2
|
|
2
|
+
class Authenticator
|
|
3
|
+
include OAuth2::FilteredAttributes
|
|
4
|
+
|
|
5
|
+
attr_reader mode: (Symbol | String)
|
|
6
|
+
attr_reader id: String?
|
|
7
|
+
attr_reader secret: String?
|
|
8
|
+
|
|
9
|
+
def initialize: (String? id, String? secret, (Symbol | String) mode) -> void
|
|
10
|
+
|
|
11
|
+
def apply: (Hash[untyped, untyped]) -> Hash[untyped, untyped]
|
|
12
|
+
|
|
13
|
+
def self.encode_basic_auth: (String, String) -> String
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def apply_params_auth: (Hash[untyped, untyped]) -> Hash[untyped, untyped]
|
|
18
|
+
def apply_client_id: (Hash[untyped, untyped]) -> Hash[untyped, untyped]
|
|
19
|
+
def apply_basic_auth: (Hash[untyped, untyped]) -> Hash[untyped, untyped]
|
|
20
|
+
def basic_auth_header: () -> Hash[String, String]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module OAuth2
|
|
2
|
+
class Client
|
|
3
|
+
RESERVED_REQ_KEYS: Array[String]
|
|
4
|
+
RESERVED_PARAM_KEYS: Array[String]
|
|
5
|
+
|
|
6
|
+
include OAuth2::FilteredAttributes
|
|
7
|
+
|
|
8
|
+
attr_reader id: String
|
|
9
|
+
attr_reader secret: String
|
|
10
|
+
attr_reader site: String?
|
|
11
|
+
attr_accessor options: Hash[Symbol, untyped]
|
|
12
|
+
attr_writer connection: untyped
|
|
13
|
+
|
|
14
|
+
def initialize: (String client_id, String client_secret, ?Hash[Symbol, untyped]) { (untyped) -> void } -> void
|
|
15
|
+
|
|
16
|
+
def site=: (String) -> String
|
|
17
|
+
|
|
18
|
+
def connection: () -> untyped
|
|
19
|
+
|
|
20
|
+
def authorize_url: (?Hash[untyped, untyped]) -> String
|
|
21
|
+
def token_url: (?Hash[untyped, untyped]) -> String
|
|
22
|
+
def revoke_url: (?Hash[untyped, untyped]) -> String
|
|
23
|
+
|
|
24
|
+
def request: (Symbol verb, String url, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
|
|
25
|
+
|
|
26
|
+
def get_token: (Hash[untyped, untyped] params, ?Hash[Symbol, untyped] access_token_opts, ?Proc) { (Hash[Symbol, untyped]) -> void } -> (OAuth2::AccessToken | nil)
|
|
27
|
+
|
|
28
|
+
def revoke_token: (String token, ?String token_type_hint, ?Hash[Symbol, untyped]) { (untyped) -> void } -> OAuth2::Response
|
|
29
|
+
|
|
30
|
+
def http_method: () -> Symbol
|
|
31
|
+
|
|
32
|
+
def auth_code: () -> OAuth2::Strategy::AuthCode
|
|
33
|
+
def implicit: () -> OAuth2::Strategy::Implicit
|
|
34
|
+
def password: () -> OAuth2::Strategy::Password
|
|
35
|
+
def client_credentials: () -> OAuth2::Strategy::ClientCredentials
|
|
36
|
+
def assertion: () -> OAuth2::Strategy::Assertion
|
|
37
|
+
|
|
38
|
+
def redirection_params: () -> Hash[String, String]
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
def params_to_req_opts: (Hash[untyped, untyped]) -> Hash[Symbol, untyped]
|
|
43
|
+
def parse_snaky_params_headers: (Hash[untyped, untyped]) -> [Symbol, bool, untyped, (Symbol | nil), Hash[untyped, untyped], Hash[String, String]]
|
|
44
|
+
def execute_request: (Symbol verb, String url, ?Hash[Symbol, untyped]) { (Faraday::Request) -> void } -> OAuth2::Response
|
|
45
|
+
def authenticator: () -> OAuth2::Authenticator
|
|
46
|
+
def parse_response_legacy: (OAuth2::Response, Hash[Symbol, untyped], Proc) -> (OAuth2::AccessToken | nil)
|
|
47
|
+
def parse_response: (OAuth2::Response, Hash[Symbol, untyped]) -> (OAuth2::AccessToken | nil)
|
|
48
|
+
def build_access_token: (OAuth2::Response, Hash[Symbol, untyped], untyped) -> OAuth2::AccessToken
|
|
49
|
+
def build_access_token_legacy: (OAuth2::Response, Hash[Symbol, untyped], Proc) -> (OAuth2::AccessToken | nil)
|
|
50
|
+
def oauth_debug_logging: (untyped) -> void
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module OAuth2
|
|
2
|
+
module FilteredAttributes
|
|
3
|
+
module InitializerMethods
|
|
4
|
+
def initialize: (*untyped args) { () -> untyped } -> untyped
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def self.included: (untyped) -> untyped
|
|
8
|
+
def filtered_attributes: (*(String | Symbol)) -> void
|
|
9
|
+
def thing_filter: () -> OAuth2::ThingFilter
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module OAuth2
|
|
2
|
+
class Response
|
|
3
|
+
DEFAULT_OPTIONS: Hash[Symbol, untyped]
|
|
4
|
+
|
|
5
|
+
def self.register_parser: (Symbol key, (Array[String] | String) mime_types) { (String) -> untyped } -> void
|
|
6
|
+
|
|
7
|
+
def initialize: (untyped response, parse: Symbol?, snaky: bool?, snaky_hash_klass: untyped?, options: Hash[Symbol, untyped]?) -> void
|
|
8
|
+
def headers: () -> Hash[untyped, untyped]
|
|
9
|
+
def status: () -> Integer
|
|
10
|
+
def body: () -> String
|
|
11
|
+
def parsed: () -> untyped
|
|
12
|
+
def content_type: () -> (String | nil)
|
|
13
|
+
def parser: () -> (untyped | nil)
|
|
14
|
+
|
|
15
|
+
attr_reader response: untyped
|
|
16
|
+
attr_accessor options: Hash[Symbol, untyped]
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module OAuth2
|
|
2
|
+
class SanitizedLogger
|
|
3
|
+
def initialize: (untyped logger) -> void
|
|
4
|
+
|
|
5
|
+
def add: (untyped severity, ?untyped message, ?untyped progname) { () -> untyped } -> untyped
|
|
6
|
+
def <<: (String message) -> untyped
|
|
7
|
+
def debug: (?untyped progname) { () -> untyped } -> untyped
|
|
8
|
+
def info: (?untyped progname) { () -> untyped } -> untyped
|
|
9
|
+
def warn: (?untyped progname) { () -> untyped } -> untyped
|
|
10
|
+
def error: (?untyped progname) { () -> untyped } -> untyped
|
|
11
|
+
def fatal: (?untyped progname) { () -> untyped } -> untyped
|
|
12
|
+
def unknown: (?untyped progname) { () -> untyped } -> untyped
|
|
13
|
+
def close: () -> void
|
|
14
|
+
def formatter: () -> untyped
|
|
15
|
+
def formatter=: (untyped formatter) -> void
|
|
16
|
+
def level: () -> untyped
|
|
17
|
+
def level=: (untyped level) -> void
|
|
18
|
+
def progname: () -> untyped
|
|
19
|
+
def progname=: (untyped progname) -> void
|
|
20
|
+
def respond_to_missing?: (Symbol method_name, ?bool include_private) -> bool
|
|
21
|
+
def method_missing: (Symbol method_name, *untyped args) { () -> untyped } -> untyped
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def log: (Symbol level, ?untyped progname) { () -> untyped } -> untyped
|
|
26
|
+
def sanitize: (untyped message) -> untyped
|
|
27
|
+
def thing_filter: () -> OAuth2::ThingFilter
|
|
28
|
+
def sanitize_authorization_header: (String message) -> String
|
|
29
|
+
def sanitize_json_pairs: (String message) -> String
|
|
30
|
+
def sanitize_form_and_query_pairs: (String message) -> String
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module OAuth2
|
|
2
|
+
module Strategy
|
|
3
|
+
class Base
|
|
4
|
+
def initialize: (OAuth2::Client) -> void
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
class AuthCode < Base
|
|
8
|
+
def authorize_params: (?Hash[untyped, untyped]) -> Hash[untyped, untyped]
|
|
9
|
+
def authorize_url: (?Hash[untyped, untyped]) -> String
|
|
10
|
+
def get_token: (String, ?Hash[untyped, untyped], ?Hash[Symbol, untyped]) -> OAuth2::AccessToken
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
class Implicit < Base
|
|
14
|
+
def authorize_params: (?Hash[untyped, untyped]) -> Hash[untyped, untyped]
|
|
15
|
+
def authorize_url: (?Hash[untyped, untyped]) -> String
|
|
16
|
+
def get_token: (*untyped) -> void
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class Password < Base
|
|
20
|
+
def authorize_url: () -> void
|
|
21
|
+
def get_token: (String, String, ?Hash[untyped, untyped], ?Hash[Symbol, untyped]) -> OAuth2::AccessToken
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class ClientCredentials < Base
|
|
25
|
+
def authorize_url: () -> void
|
|
26
|
+
def get_token: (?Hash[untyped, untyped], ?Hash[Symbol, untyped]) -> OAuth2::AccessToken
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class Assertion < Base
|
|
30
|
+
def authorize_url: () -> void
|
|
31
|
+
def get_token: (Hash[untyped, untyped], Hash[Symbol, untyped], ?Hash[Symbol, untyped], ?Hash[Symbol, untyped]) -> OAuth2::AccessToken
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
module OAuth2
|
|
2
|
+
class ThingFilter
|
|
3
|
+
attr_reader things: Array[String]
|
|
4
|
+
attr_reader label: String
|
|
5
|
+
|
|
6
|
+
def initialize: (Enumerable[untyped] things, label: String) -> void
|
|
7
|
+
def filtered?: (untyped thing_name) -> bool
|
|
8
|
+
def pattern_source: () -> String
|
|
9
|
+
end
|
|
10
|
+
end
|
data/sig/oauth2.rbs
ADDED
data.tar.gz.sig
ADDED
|
Binary file
|