oauth2 2.0.9 → 2.0.22
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 +3 -0
- data/CHANGELOG.md +833 -182
- data/CITATION.cff +20 -0
- data/CODE_OF_CONDUCT.md +24 -23
- data/CONTRIBUTING.md +262 -34
- data/FUNDING.md +74 -0
- data/LICENSE.md +110 -0
- data/README.md +923 -351
- data/RUBOCOP.md +71 -0
- data/SECURITY.md +11 -16
- data/certs/pboling.pem +27 -0
- data/lib/oauth2/access_token.rb +233 -38
- data/lib/oauth2/auth_sanitizer.rb +36 -0
- data/lib/oauth2/authenticator.rb +43 -9
- data/lib/oauth2/client.rb +353 -97
- data/lib/oauth2/error.rb +37 -17
- data/lib/oauth2/filtered_attributes.rb +10 -0
- data/lib/oauth2/response.rb +87 -49
- data/lib/oauth2/strategy/assertion.rb +10 -7
- data/lib/oauth2/strategy/auth_code.rb +13 -3
- data/lib/oauth2/strategy/client_credentials.rb +2 -2
- data/lib/oauth2/strategy/implicit.rb +11 -3
- data/lib/oauth2/strategy/password.rb +14 -4
- data/lib/oauth2/version.rb +2 -1
- data/lib/oauth2.rb +86 -23
- 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 +6 -0
- data/sig/oauth2.rbs +9 -0
- data.tar.gz.sig +0 -0
- metadata +270 -76
- metadata.gz.sig +0 -0
- data/LICENSE +0 -22
|
@@ -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
|