oauth2 2.0.9 → 2.0.17
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 +662 -183
- data/CITATION.cff +20 -0
- data/CODE_OF_CONDUCT.md +24 -23
- data/CONTRIBUTING.md +219 -34
- data/FUNDING.md +77 -0
- data/{LICENSE → LICENSE.txt} +2 -2
- data/OIDC.md +158 -0
- data/README.md +1428 -306
- data/REEK +0 -0
- data/RUBOCOP.md +71 -0
- data/SECURITY.md +11 -16
- data/lib/oauth2/access_token.rb +236 -38
- data/lib/oauth2/authenticator.rb +39 -7
- data/lib/oauth2/client.rb +311 -96
- data/lib/oauth2/error.rb +35 -17
- data/lib/oauth2/filtered_attributes.rb +52 -0
- data/lib/oauth2/response.rb +78 -42
- data/lib/oauth2/strategy/assertion.rb +8 -5
- 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 +1 -1
- data/lib/oauth2.rb +59 -18
- 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 +6 -0
- data/sig/oauth2/response.rbs +18 -0
- data/sig/oauth2/strategy.rbs +34 -0
- data/sig/oauth2/version.rbs +5 -0
- data/sig/oauth2.rbs +9 -0
- data.tar.gz.sig +0 -0
- metadata +292 -75
- metadata.gz.sig +0 -0
|
@@ -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,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,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
|
data/sig/oauth2.rbs
ADDED
data.tar.gz.sig
ADDED
|
Binary file
|