authproto 0.3.0.beta2 → 0.3.0.beta4
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
- data/CHANGELOG.md +36 -0
- data/README.md +108 -5
- data/examples/confidential_client/Gemfile.lock +1 -1
- data/examples/confidential_client/README.md +11 -1
- data/examples/confidential_client/app.rb +35 -17
- data/examples/confidential_client/scripts/generate_keys.rb +1 -1
- data/examples/minisky_console/Gemfile.lock +2 -2
- data/examples/minisky_console/README.md +20 -1
- data/examples/minisky_console/localhost.rb +5 -3
- data/examples/minisky_console/production.rb +9 -3
- data/lib/authproto/client.rb +173 -123
- data/lib/authproto/configuration.rb +37 -16
- data/lib/authproto/dpop/client.rb +105 -40
- data/lib/authproto/dpop/{key_manager.rb → key_set.rb} +54 -120
- data/lib/authproto/dpop/nonce_manager.rb +38 -29
- data/lib/authproto/dpop/proof_generator.rb +21 -35
- data/lib/authproto/dpop.rb +19 -0
- data/lib/authproto/encryption.rb +29 -12
- data/lib/authproto/http_client.rb +8 -7
- data/lib/authproto/http_helpers.rb +85 -0
- data/lib/authproto/metadata/authorization_server.rb +23 -6
- data/lib/authproto/metadata/client_metadata.rb +46 -6
- data/lib/authproto/metadata/resource_server.rb +7 -5
- data/lib/authproto/minisky.rb +36 -34
- data/lib/authproto/par/client.rb +22 -73
- data/lib/authproto/par/client_assertion.rb +47 -16
- data/lib/authproto/par/request.rb +4 -8
- data/lib/authproto/par.rb +2 -1
- data/lib/authproto/serialization/session.rb +33 -13
- data/lib/authproto/serialization/token_set.rb +6 -4
- data/lib/authproto/state/session.rb +102 -6
- data/lib/authproto/state/session_manager.rb +120 -22
- data/lib/authproto/state/token_set.rb +22 -19
- data/lib/authproto/state.rb +2 -2
- data/lib/authproto/storage/key_builder.rb +3 -11
- data/lib/authproto/storage/memory.rb +8 -2
- data/lib/authproto/token/identity.rb +54 -0
- data/lib/authproto/token/refresh.rb +66 -109
- data/lib/authproto/token/response.rb +73 -0
- data/lib/authproto/token/revocation.rb +92 -0
- data/lib/authproto/validated_uri.rb +23 -0
- data/lib/authproto/version.rb +1 -1
- data/lib/authproto.rb +0 -1
- data/sig/authproto/client.rbs +10 -10
- data/sig/authproto/dependencies.rbs +2 -0
- data/sig/authproto/dpop/client.rbs +11 -4
- data/sig/authproto/dpop/{key_manager.rbs → key_set.rbs} +9 -11
- data/sig/authproto/dpop/nonce_manager.rbs +4 -4
- data/sig/authproto/dpop/proof_generator.rbs +5 -10
- data/sig/authproto/dpop.rbs +6 -0
- data/sig/authproto/encryption.rbs +4 -2
- data/sig/authproto/http_client.rbs +0 -1
- data/sig/authproto/http_helpers.rbs +7 -0
- data/sig/authproto/localhost_server.rbs +1 -1
- data/sig/authproto/metadata/authorization_server.rbs +1 -0
- data/sig/authproto/metadata/client_metadata.rbs +3 -1
- data/sig/authproto/metadata/resource_server.rbs +1 -0
- data/sig/authproto/minisky_oauth.rbs +5 -2
- data/sig/authproto/par/client.rbs +4 -8
- data/sig/authproto/par/client_assertion.rbs +4 -0
- data/sig/authproto/par/request.rbs +0 -9
- data/sig/authproto/state/session.rbs +13 -3
- data/sig/authproto/state/session_manager.rbs +10 -3
- data/sig/authproto/state/token_set.rbs +1 -2
- data/sig/authproto/storage/key_builder.rbs +1 -2
- data/sig/authproto/token/refresh.rbs +5 -5
- data/sig/authproto/token/response.rbs +12 -0
- data/sig/authproto/token/revocation.rbs +14 -0
- data/sig/authproto.rbs +6 -3
- metadata +30 -23
- data/.rspec +0 -1
- data/.rubocop.yml +0 -31
- data/.tm_properties +0 -1
- data/.yardopts +0 -5
- data/AGENTS.md +0 -80
- data/Rakefile +0 -8
- data/examples/confidential_client/.gitignore +0 -6
- data/examples/minisky_console/.gitignore +0 -2
- data/lib/authproto/serialization/dpop_key.rb +0 -38
- data/misc/yard_attributes.rb +0 -34
- data/sig/authproto/serialization/dpop_key.rbs +0 -14
|
@@ -1,35 +1,30 @@
|
|
|
1
1
|
module AuthProto
|
|
2
2
|
module DPoP
|
|
3
3
|
class ProofGenerator
|
|
4
|
-
@key_manager: AuthProto::DPoP::KeyManager
|
|
5
|
-
|
|
6
4
|
class ProofError < AuthProto::Error
|
|
7
5
|
end
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def initialize: (AuthProto::DPoP::KeyManager key_manager) -> void
|
|
7
|
+
def initialize: () -> void
|
|
12
8
|
|
|
13
9
|
def generate: (
|
|
10
|
+
key_set: KeySet,
|
|
14
11
|
method: String,
|
|
15
12
|
uri: String,
|
|
16
13
|
?nonce: String?,
|
|
17
|
-
?access_token: String
|
|
18
|
-
?ath: bool?
|
|
14
|
+
?access_token: String?
|
|
19
15
|
) -> JOSE::SignedBinary
|
|
20
16
|
|
|
21
17
|
private
|
|
22
18
|
|
|
23
19
|
def validate_inputs: (String method, String uri) -> void
|
|
24
20
|
|
|
25
|
-
def build_header: () -> { typ: "dpop+jwt", alg: "ES256", jwk: Hash[String, untyped] }
|
|
21
|
+
def build_header: (KeySet key_set) -> { typ: "dpop+jwt", alg: "ES256", jwk: Hash[String, untyped] }
|
|
26
22
|
|
|
27
23
|
def build_payload: (
|
|
28
24
|
method: String,
|
|
29
25
|
uri: String,
|
|
30
26
|
?nonce: String?,
|
|
31
|
-
?access_token: String
|
|
32
|
-
?include_ath: bool?
|
|
27
|
+
?access_token: String?
|
|
33
28
|
) -> Hash[String, untyped]
|
|
34
29
|
|
|
35
30
|
def normalize_uri: (String uri) -> String
|
|
@@ -11,13 +11,15 @@ module AuthProto
|
|
|
11
11
|
class DecryptionError < Error
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
+
CIPHER: String
|
|
15
|
+
VERSION: Integer
|
|
16
|
+
MASTER_KEY_BYTES: Integer
|
|
17
|
+
|
|
14
18
|
module HKDF
|
|
15
19
|
def self.derive: (_ToS secret, salt: String, info: String, length: Integer) -> String
|
|
16
20
|
end
|
|
17
21
|
|
|
18
22
|
class Service
|
|
19
|
-
CIPHER: String
|
|
20
|
-
VERSION: Integer
|
|
21
23
|
def initialize: () -> void
|
|
22
24
|
def encrypt: (_ToS data, context: String) -> envelope
|
|
23
25
|
def decrypt: (envelope encrypted, context: String) -> String
|
|
@@ -39,7 +39,6 @@ module AuthProto
|
|
|
39
39
|
def add_security_headers: (Net::HTTPRequest request, Hash[String, String] headers) -> void
|
|
40
40
|
def handle_redirect: (original_uri: URI::HTTP, response: Net::HTTPResponse, headers: Hash[String, String], redirect_count: Integer) -> Net::HTTPResponse
|
|
41
41
|
def validate_response: (Net::HTTPResponse response) -> void
|
|
42
|
-
def check_success_status: (Net::HTTPResponse response) -> void
|
|
43
42
|
def check_content_length: (Net::HTTPResponse response) -> void
|
|
44
43
|
end
|
|
45
44
|
end
|
|
@@ -2,6 +2,7 @@ module AuthProto
|
|
|
2
2
|
module Metadata
|
|
3
3
|
# Handles and validates AT Protocol OAuth client metadata.
|
|
4
4
|
class ClientMetadata
|
|
5
|
+
extend HTTPHelpers
|
|
5
6
|
AUTH_METHOD_PRIVATE_KEY_JWT: String
|
|
6
7
|
AUTH_METHOD_NONE: String
|
|
7
8
|
SCOPE_PATTERN: Regexp
|
|
@@ -55,7 +56,7 @@ module AuthProto
|
|
|
55
56
|
|
|
56
57
|
def self.from_url: (String url) -> ClientMetadata
|
|
57
58
|
|
|
58
|
-
def self.from_localhost_url: (String url) -> ClientMetadata
|
|
59
|
+
private def self.from_localhost_url: (String url) -> ClientMetadata
|
|
59
60
|
|
|
60
61
|
def confidential?: () -> bool
|
|
61
62
|
|
|
@@ -66,6 +67,7 @@ module AuthProto
|
|
|
66
67
|
def validate_client_id: (String client_id) -> String
|
|
67
68
|
|
|
68
69
|
def valid_https_client_id?: (String client_id) -> bool
|
|
70
|
+
def valid_client_id_hostname?: (String hostname) -> bool
|
|
69
71
|
|
|
70
72
|
def valid_localhost_client_id?: (String client_id) -> bool
|
|
71
73
|
|
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
# Additional methods mixed in from Minisky::Requests belong to the minisky gem.
|
|
3
3
|
class Minisky
|
|
4
4
|
class OAuthClient
|
|
5
|
+
include AuthProto::HTTPHelpers
|
|
5
6
|
MAX_NONCE_RETRIES: Integer
|
|
6
7
|
attr_reader host: String
|
|
7
8
|
attr_reader oauth_client: AuthProto::Client
|
|
8
9
|
attr_reader session_id: String?
|
|
9
10
|
|
|
10
|
-
def initialize: (String host, client_id: String, redirect_uri: String, ?metadata: AuthProto::json_object?, ?
|
|
11
|
+
def initialize: (String host, client_id: String, redirect_uri: String, ?metadata: AuthProto::json_object?, ?signing_key: (AuthProto::json_object | JOSE::JWK)?, ?session_id: String?) -> void
|
|
11
12
|
def config: () -> nil
|
|
12
13
|
def authorize: (?handle: String?, ?pds: String?, ?scope: String) -> AuthProto::authorization_result
|
|
13
|
-
def handle_callback: (
|
|
14
|
+
def handle_callback: (
|
|
15
|
+
code: String, state: String, iss: String, expected_session_id: String
|
|
16
|
+
) -> AuthProto::callback_result
|
|
14
17
|
def get_request: (String | URI::HTTP method, ?Hash[untyped, untyped]? params, ?auth: bool, ?headers: Hash[String, String]?) -> untyped
|
|
15
18
|
def post_request: (String | URI::HTTP method, ?untyped data, ?auth: bool, ?headers: Hash[String, String]?, ?params: Hash[untyped, untyped]?) -> untyped
|
|
16
19
|
def log_in: (*untyped args) -> bot
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
module AuthProto
|
|
2
2
|
module PAR
|
|
3
3
|
class Client
|
|
4
|
+
include HTTPHelpers
|
|
4
5
|
attr_reader authorization_server: Metadata::AuthorizationServer
|
|
5
6
|
attr_reader par_endpoint: String
|
|
6
7
|
attr_reader dpop_client: DPoP::Client
|
|
7
8
|
|
|
8
9
|
def initialize: (authorization_server: Metadata::AuthorizationServer, dpop_client: DPoP::Client) -> void
|
|
9
|
-
def submit: (Request request) -> Response
|
|
10
|
-
def extract_nonce: (http_response response) -> String
|
|
10
|
+
def submit: (Request request, session: State::Session) -> Response
|
|
11
11
|
def build_authorization_url: (request_uri: String, client_id: String) -> String
|
|
12
12
|
|
|
13
13
|
private
|
|
14
|
-
def make_request: (Request request) -> http_response
|
|
15
|
-
def build_headers: (Request request, String dpop_proof) -> Hash[String, String]
|
|
16
|
-
def requires_nonce?: (http_response response) -> bool
|
|
17
|
-
def store_nonce: (String nonce) -> void
|
|
18
|
-
def server_origin: () -> String
|
|
14
|
+
def make_request: (Request request, session: State::Session) -> http_response
|
|
19
15
|
def handle_error_response: (http_response response) -> bot
|
|
20
|
-
def
|
|
16
|
+
def handle_success_response: (http_response response) -> Response
|
|
21
17
|
end
|
|
22
18
|
end
|
|
23
19
|
end
|
|
@@ -3,9 +3,13 @@ module AuthProto
|
|
|
3
3
|
class ClientAssertion
|
|
4
4
|
class Error < AuthProto::Error
|
|
5
5
|
end
|
|
6
|
+
ALGORITHM: String
|
|
6
7
|
attr_reader signing_key: JOSE::JWK
|
|
7
8
|
def initialize: (client_id: String, signing_key: (json_object | JOSE::JWK)) -> void
|
|
8
9
|
def generate_jwt: (audience: String, ?lifetime: Integer) -> String
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
def validate_signing_key: ((json_object | JOSE::JWK) signing_key) -> JOSE::JWK
|
|
9
13
|
end
|
|
10
14
|
end
|
|
11
15
|
end
|
|
@@ -8,7 +8,6 @@ module AuthProto
|
|
|
8
8
|
@scope: String
|
|
9
9
|
@login_hint: String?
|
|
10
10
|
@nonce: String?
|
|
11
|
-
@dpop_proof: String?
|
|
12
11
|
@client_assertion: ClientAssertion?
|
|
13
12
|
|
|
14
13
|
class Configuration
|
|
@@ -19,7 +18,6 @@ module AuthProto
|
|
|
19
18
|
attr_accessor scope: String?
|
|
20
19
|
attr_accessor login_hint: String?
|
|
21
20
|
attr_accessor nonce: String?
|
|
22
|
-
attr_accessor dpop_proof: String?
|
|
23
21
|
attr_accessor client_assertion: ClientAssertion?
|
|
24
22
|
end
|
|
25
23
|
|
|
@@ -30,7 +28,6 @@ module AuthProto
|
|
|
30
28
|
attr_reader scope: String
|
|
31
29
|
attr_reader login_hint: String?
|
|
32
30
|
attr_reader nonce: String?
|
|
33
|
-
attr_reader dpop_proof: String?
|
|
34
31
|
attr_reader client_assertion: ClientAssertion?
|
|
35
32
|
|
|
36
33
|
def self.build: () { (Configuration) -> untyped } -> Request
|
|
@@ -43,16 +40,10 @@ module AuthProto
|
|
|
43
40
|
|
|
44
41
|
def build_params: (audience: String?) -> Hash[String, String]
|
|
45
42
|
|
|
46
|
-
def add_optional_params: (Hash[String, String] params) -> void
|
|
47
|
-
|
|
48
|
-
def add_client_auth_params: (Hash[String, String] params) -> void
|
|
49
|
-
|
|
50
43
|
def validate_request: () -> void
|
|
51
44
|
|
|
52
45
|
def validate_required_params: () -> void
|
|
53
46
|
|
|
54
|
-
def validate_scope: () -> void
|
|
55
|
-
|
|
56
47
|
def validate_client_auth: () -> void
|
|
57
48
|
end
|
|
58
49
|
end
|
|
@@ -4,8 +4,12 @@ module AuthProto
|
|
|
4
4
|
include MonitorMixin
|
|
5
5
|
|
|
6
6
|
attr_reader session_id: String
|
|
7
|
-
attr_reader state_token: String
|
|
7
|
+
attr_reader state_token: String?
|
|
8
|
+
attr_reader authorization_expires_at: Time?
|
|
8
9
|
attr_reader client_id: String
|
|
10
|
+
attr_reader dpop_key: DPoP::KeySet
|
|
11
|
+
attr_reader signing_key_id: String?
|
|
12
|
+
attr_reader signing_key_thumbprint: String?
|
|
9
13
|
attr_reader scope: String
|
|
10
14
|
attr_reader pkce_verifier: String
|
|
11
15
|
attr_reader pkce_challenge: String
|
|
@@ -13,12 +17,18 @@ module AuthProto
|
|
|
13
17
|
attr_reader did: String?
|
|
14
18
|
attr_reader tokens: TokenSet?
|
|
15
19
|
|
|
16
|
-
def initialize: (client_id: String, scope: String, ?auth_server: Metadata::AuthorizationServer?, ?did: String?) -> void
|
|
20
|
+
def initialize: (client_id: String, scope: String, ?auth_server: Metadata::AuthorizationServer?, ?did: String?, ?signing_key_id: String?, ?signing_key_thumbprint: String?, ?dpop_key: DPoP::KeySet, ?authorization_expires_at: Time?) -> void
|
|
21
|
+
def clear_state_token: () -> nil
|
|
17
22
|
def authorization_server=: (Metadata::AuthorizationServer server) -> Metadata::AuthorizationServer
|
|
18
23
|
def did=: (String did) -> String
|
|
19
24
|
def tokens=: (TokenSet tokens) -> String
|
|
25
|
+
def granted_scope: () -> String?
|
|
26
|
+
def has_limited_scope?: () -> bool
|
|
20
27
|
def session_data: () -> AuthProto::session_data?
|
|
21
|
-
def
|
|
28
|
+
def pending?: () -> bool
|
|
29
|
+
def can_be_revoked?: () -> bool
|
|
30
|
+
def tokens_valid?: () -> bool
|
|
31
|
+
alias authorized? tokens_valid?
|
|
22
32
|
def renewable?: () -> bool
|
|
23
33
|
end
|
|
24
34
|
end
|
|
@@ -2,14 +2,21 @@ module AuthProto
|
|
|
2
2
|
module State
|
|
3
3
|
class SessionManager
|
|
4
4
|
@serializer: Serialization::Session
|
|
5
|
+
@client_id: String
|
|
6
|
+
@supported_signing_keys: Hash[String, String]
|
|
5
7
|
|
|
6
|
-
def initialize: () -> void
|
|
7
|
-
def create_session: (client_id: String, scope: String, ?auth_server: Metadata::AuthorizationServer?, ?did: String?) -> Session
|
|
8
|
+
def initialize: (client_id: String, ?supported_signing_keys: Hash[String, String]) -> void
|
|
9
|
+
def create_session: (client_id: String, scope: String, ?auth_server: Metadata::AuthorizationServer?, ?did: String?, ?signing_key_id: String?) -> Session
|
|
8
10
|
def update_session: (Session session) -> Session
|
|
11
|
+
def complete_authorization: (Session session) -> Session
|
|
9
12
|
def get_session: (String session_id) -> Session?
|
|
10
|
-
def
|
|
13
|
+
def get_session_by_state_token: (String? state) -> Session?
|
|
11
14
|
def delete_session: (String session_id) -> void
|
|
12
15
|
def cleanup_expired: () -> void
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
def validate_client_id: (String client_id) -> void
|
|
19
|
+
def session_ttl: (Session session) -> Integer?
|
|
13
20
|
end
|
|
14
21
|
end
|
|
15
22
|
end
|
|
@@ -3,14 +3,13 @@ module AuthProto
|
|
|
3
3
|
class TokenSet
|
|
4
4
|
@access_token: String
|
|
5
5
|
@refresh_token: String?
|
|
6
|
-
@token_type: String
|
|
7
6
|
@scope: String
|
|
8
7
|
@sub: String
|
|
9
8
|
@expires_at: Time
|
|
10
9
|
|
|
11
10
|
attr_reader access_token: String
|
|
12
11
|
attr_reader refresh_token: String?
|
|
13
|
-
|
|
12
|
+
def token_type: () -> "DPoP"
|
|
14
13
|
attr_reader scope: String
|
|
15
14
|
attr_reader expires_at: Time
|
|
16
15
|
attr_reader sub: String
|
|
@@ -5,8 +5,7 @@ module AuthProto
|
|
|
5
5
|
NAMESPACE_PREFIX: String
|
|
6
6
|
def self.session_key: (String id) -> String
|
|
7
7
|
def self.state_key: (String token) -> String
|
|
8
|
-
def self.nonce_key: (String server_url) -> String
|
|
9
|
-
def self.dpop_key: (String client_id) -> String
|
|
8
|
+
def self.nonce_key: (String session_id, String server_url) -> String
|
|
10
9
|
def self.lock_key: (String namespace, String id) -> String
|
|
11
10
|
|
|
12
11
|
private
|
|
@@ -17,6 +17,7 @@ module AuthProto
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
class Refresh
|
|
20
|
+
include HTTPHelpers
|
|
20
21
|
include MonitorMixin
|
|
21
22
|
MAX_RETRIES: Integer
|
|
22
23
|
BASE_DELAY: Integer
|
|
@@ -26,22 +27,21 @@ module AuthProto
|
|
|
26
27
|
attr_reader auth_server: Metadata::AuthorizationServer
|
|
27
28
|
attr_reader client_metadata: Metadata::ClientMetadata
|
|
28
29
|
|
|
29
|
-
def initialize: (session: State::Session, dpop_client: DPoP::Client, auth_server: Metadata::AuthorizationServer, client_metadata: Metadata::ClientMetadata, ?
|
|
30
|
+
def initialize: (session: State::Session, dpop_client: DPoP::Client, auth_server: Metadata::AuthorizationServer, client_metadata: Metadata::ClientMetadata, ?client_assertion: PAR::ClientAssertion?) -> void
|
|
30
31
|
def perform_refresh: () -> State::TokenSet
|
|
31
32
|
|
|
32
33
|
private
|
|
34
|
+
def revoke_rejected_refresh_token: (String token) -> void
|
|
33
35
|
def with_retries: [T] () { () -> T } -> T
|
|
34
36
|
def calculate_delay: () -> Float
|
|
35
37
|
def request_token_refresh: () -> State::TokenSet
|
|
36
38
|
def make_token_request: (State::Session session) -> http_response
|
|
37
|
-
def requires_dpop_nonce?: (http_response response) -> bool
|
|
38
|
-
def extract_dpop_nonce: (http_response response) -> String
|
|
39
39
|
def add_client_authentication: (Hash[Symbol, untyped] body) -> void
|
|
40
40
|
def handle_refresh_response: (http_response response) -> State::TokenSet
|
|
41
41
|
def process_successful_response: (http_response response) -> State::TokenSet
|
|
42
|
-
def
|
|
42
|
+
def handle_error_response: (http_response response) -> bot
|
|
43
43
|
def handle_rate_limit_response: (http_response response) -> bot
|
|
44
|
-
def
|
|
44
|
+
def validate_refresh_identity: (State::TokenSet tokens) -> void
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module AuthProto
|
|
2
|
+
module Token
|
|
3
|
+
class Revocation
|
|
4
|
+
class Error < AuthProto::Error
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def initialize: (session: State::Session, dpop_client: DPoP::Client, client_metadata: Metadata::ClientMetadata, ?client_assertion: PAR::ClientAssertion?) -> void
|
|
8
|
+
def revoke_token: (String token, token_type: String | Symbol) -> void
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
def make_request: (String token, String endpoint, String token_type) -> http_response
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
data/sig/authproto.rbs
CHANGED
|
@@ -8,7 +8,7 @@ module AuthProto
|
|
|
8
8
|
type http_body = String | Hash[untyped, untyped] | nil
|
|
9
9
|
type http_response = { status: Integer, headers: Hash[String, String], body: String? }
|
|
10
10
|
type session_data = { access_token: String, token_type: String, expires_in: Integer,
|
|
11
|
-
refresh_token: String?, scope: String, session_id: String, did: String }
|
|
11
|
+
refresh_token: String?, scope: String, granted_scope: String, session_id: String, did: String }
|
|
12
12
|
type token_info = session_data
|
|
13
13
|
type refreshed_tokens = session_data
|
|
14
14
|
type callback_result = session_data
|
|
@@ -34,16 +34,19 @@ module AuthProto
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
class Configuration
|
|
37
|
-
attr_accessor
|
|
37
|
+
attr_accessor client_assertion_lifetime: Integer
|
|
38
38
|
attr_accessor dpop_nonce_lifetime: Integer
|
|
39
|
-
attr_accessor encryption: untyped
|
|
40
39
|
attr_accessor http_client: _HTTPClient?
|
|
41
40
|
attr_accessor logger: Logger
|
|
41
|
+
attr_accessor pending_session_ttl: Integer
|
|
42
42
|
attr_accessor storage: Storage::Interface
|
|
43
43
|
def initialize: () -> void
|
|
44
44
|
def validate: () -> true
|
|
45
45
|
|
|
46
46
|
private
|
|
47
|
+
def validate_client_assertion_lifetime: () -> void
|
|
48
|
+
def validate_dpop_nonce_lifetime: () -> void
|
|
49
|
+
def validate_pending_session_ttl: () -> void
|
|
47
50
|
def validate_storage: () -> void
|
|
48
51
|
def validate_http_client: () -> void
|
|
49
52
|
end
|
metadata
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: authproto
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.0.
|
|
4
|
+
version: 0.3.0.beta4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josh Huckabee
|
|
8
8
|
- Kuba Suder
|
|
9
|
-
bindir:
|
|
9
|
+
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
@@ -52,24 +52,26 @@ dependencies:
|
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: 0.5.0
|
|
55
|
-
description: A Ruby
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
description: "\n A Ruby gem implementing an OAuth 2.1 client specifically targeted
|
|
56
|
+
for use in AT Protocol context. Supports both\n public and confidential clients,
|
|
57
|
+
handles DPoP, nonce management, client and server metadata JSON, PAR, PKCE,\n client
|
|
58
|
+
assertions for confidential clients, storage of session state, and at rest encryption
|
|
59
|
+
of stored tokens.\n Includes SQLite, Redis and in-memory storage backends, and
|
|
60
|
+
an adapter for using the Minisky gem with OAuth\n login support.\n\n This
|
|
61
|
+
gem deliberately does not support any features, profiles and configurations of OAuth
|
|
62
|
+
that are not currently\n used in ATProto, and does not support turning off any
|
|
63
|
+
additional requirements and restrictions that ATProto\n introduces on top of
|
|
64
|
+
standard OAuth specifications.\n "
|
|
65
|
+
email:
|
|
66
|
+
- jakub.suder@gmail.com
|
|
58
67
|
executables: []
|
|
59
68
|
extensions: []
|
|
60
69
|
extra_rdoc_files: []
|
|
61
70
|
files:
|
|
62
|
-
- ".rspec"
|
|
63
|
-
- ".rubocop.yml"
|
|
64
|
-
- ".tm_properties"
|
|
65
|
-
- ".yardopts"
|
|
66
|
-
- AGENTS.md
|
|
67
71
|
- CHANGELOG.md
|
|
68
72
|
- MIT-LICENSE.txt
|
|
69
73
|
- README.md
|
|
70
|
-
- Rakefile
|
|
71
74
|
- SECURITY.md
|
|
72
|
-
- examples/confidential_client/.gitignore
|
|
73
75
|
- examples/confidential_client/Gemfile
|
|
74
76
|
- examples/confidential_client/Gemfile.lock
|
|
75
77
|
- examples/confidential_client/README.md
|
|
@@ -83,7 +85,6 @@ files:
|
|
|
83
85
|
- examples/confidential_client/views/authorized.erb
|
|
84
86
|
- examples/confidential_client/views/index.erb
|
|
85
87
|
- examples/confidential_client/views/layout.erb
|
|
86
|
-
- examples/minisky_console/.gitignore
|
|
87
88
|
- examples/minisky_console/Gemfile
|
|
88
89
|
- examples/minisky_console/Gemfile.lock
|
|
89
90
|
- examples/minisky_console/README.md
|
|
@@ -95,14 +96,16 @@ files:
|
|
|
95
96
|
- lib/authproto.rb
|
|
96
97
|
- lib/authproto/client.rb
|
|
97
98
|
- lib/authproto/configuration.rb
|
|
99
|
+
- lib/authproto/dpop.rb
|
|
98
100
|
- lib/authproto/dpop/client.rb
|
|
99
|
-
- lib/authproto/dpop/
|
|
101
|
+
- lib/authproto/dpop/key_set.rb
|
|
100
102
|
- lib/authproto/dpop/nonce_manager.rb
|
|
101
103
|
- lib/authproto/dpop/proof_generator.rb
|
|
102
104
|
- lib/authproto/dpop/stored_nonce.rb
|
|
103
105
|
- lib/authproto/encryption.rb
|
|
104
106
|
- lib/authproto/errors.rb
|
|
105
107
|
- lib/authproto/http_client.rb
|
|
108
|
+
- lib/authproto/http_helpers.rb
|
|
106
109
|
- lib/authproto/insecure_http_client.rb
|
|
107
110
|
- lib/authproto/localhost_server.rb
|
|
108
111
|
- lib/authproto/metadata.rb
|
|
@@ -117,7 +120,6 @@ files:
|
|
|
117
120
|
- lib/authproto/par/response.rb
|
|
118
121
|
- lib/authproto/pkce.rb
|
|
119
122
|
- lib/authproto/serialization/base.rb
|
|
120
|
-
- lib/authproto/serialization/dpop_key.rb
|
|
121
123
|
- lib/authproto/serialization/session.rb
|
|
122
124
|
- lib/authproto/serialization/stored_nonce.rb
|
|
123
125
|
- lib/authproto/serialization/token_set.rb
|
|
@@ -130,20 +132,24 @@ files:
|
|
|
130
132
|
- lib/authproto/storage/memory.rb
|
|
131
133
|
- lib/authproto/storage/redis.rb
|
|
132
134
|
- lib/authproto/storage/sqlite.rb
|
|
135
|
+
- lib/authproto/token/identity.rb
|
|
133
136
|
- lib/authproto/token/refresh.rb
|
|
137
|
+
- lib/authproto/token/response.rb
|
|
138
|
+
- lib/authproto/token/revocation.rb
|
|
134
139
|
- lib/authproto/validated_uri.rb
|
|
135
140
|
- lib/authproto/version.rb
|
|
136
|
-
- misc/yard_attributes.rb
|
|
137
141
|
- sig/authproto.rbs
|
|
138
142
|
- sig/authproto/client.rbs
|
|
139
143
|
- sig/authproto/dependencies.rbs
|
|
144
|
+
- sig/authproto/dpop.rbs
|
|
140
145
|
- sig/authproto/dpop/client.rbs
|
|
141
|
-
- sig/authproto/dpop/
|
|
146
|
+
- sig/authproto/dpop/key_set.rbs
|
|
142
147
|
- sig/authproto/dpop/nonce_manager.rbs
|
|
143
148
|
- sig/authproto/dpop/proof_generator.rbs
|
|
144
149
|
- sig/authproto/dpop/stored_nonce.rbs
|
|
145
150
|
- sig/authproto/encryption.rbs
|
|
146
151
|
- sig/authproto/http_client.rbs
|
|
152
|
+
- sig/authproto/http_helpers.rbs
|
|
147
153
|
- sig/authproto/insecure_http_client.rbs
|
|
148
154
|
- sig/authproto/localhost_server.rbs
|
|
149
155
|
- sig/authproto/metadata/authorization_server.rbs
|
|
@@ -157,7 +163,6 @@ files:
|
|
|
157
163
|
- sig/authproto/par/response.rbs
|
|
158
164
|
- sig/authproto/pkce.rbs
|
|
159
165
|
- sig/authproto/serialization/base.rbs
|
|
160
|
-
- sig/authproto/serialization/dpop_key.rbs
|
|
161
166
|
- sig/authproto/serialization/session.rbs
|
|
162
167
|
- sig/authproto/serialization/stored_nonce.rbs
|
|
163
168
|
- sig/authproto/serialization/token_set.rbs
|
|
@@ -172,15 +177,17 @@ files:
|
|
|
172
177
|
- sig/authproto/storage/redis_client.rbs
|
|
173
178
|
- sig/authproto/storage/sqlite.rbs
|
|
174
179
|
- sig/authproto/token/refresh.rbs
|
|
180
|
+
- sig/authproto/token/response.rbs
|
|
181
|
+
- sig/authproto/token/revocation.rbs
|
|
175
182
|
- sig/authproto/validated_uri.rbs
|
|
176
183
|
- sig/authproto/version.rbs
|
|
177
|
-
homepage: https://
|
|
184
|
+
homepage: https://tangled.org/mackuba.eu/authproto
|
|
178
185
|
licenses:
|
|
179
186
|
- MIT
|
|
180
187
|
metadata:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
188
|
+
bug_tracker_uri: https://tangled.org/mackuba.eu/authproto/issues
|
|
189
|
+
changelog_uri: https://tangled.org/mackuba.eu/authproto/blob/master/CHANGELOG.md
|
|
190
|
+
source_code_uri: https://tangled.org/mackuba.eu/authproto
|
|
184
191
|
rubygems_mfa_required: 'true'
|
|
185
192
|
rdoc_options: []
|
|
186
193
|
require_paths:
|
|
@@ -198,5 +205,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
198
205
|
requirements: []
|
|
199
206
|
rubygems_version: 4.0.23
|
|
200
207
|
specification_version: 4
|
|
201
|
-
summary: Ruby implementation of
|
|
208
|
+
summary: Ruby implementation of an AT Protocol specific OAuth client
|
|
202
209
|
test_files: []
|
data/.rspec
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
--require spec_helper
|
data/.rubocop.yml
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
AllCops:
|
|
2
|
-
NewCops: enable
|
|
3
|
-
SuggestExtensions: false
|
|
4
|
-
TargetRubyVersion: 3.2
|
|
5
|
-
|
|
6
|
-
Metrics/BlockLength:
|
|
7
|
-
Enabled: false
|
|
8
|
-
|
|
9
|
-
Metrics/ClassLength:
|
|
10
|
-
Enabled: false
|
|
11
|
-
|
|
12
|
-
Metrics/ModuleLength:
|
|
13
|
-
Enabled: false
|
|
14
|
-
|
|
15
|
-
Metrics/MethodLength:
|
|
16
|
-
Enabled: false
|
|
17
|
-
|
|
18
|
-
Metrics/AbcSize:
|
|
19
|
-
Enabled: false
|
|
20
|
-
|
|
21
|
-
Metrics/PerceivedComplexity:
|
|
22
|
-
Enabled: false
|
|
23
|
-
|
|
24
|
-
Metrics/CyclomaticComplexity:
|
|
25
|
-
Enabled: false
|
|
26
|
-
|
|
27
|
-
Style/StringLiterals:
|
|
28
|
-
EnforcedStyle: double_quotes
|
|
29
|
-
|
|
30
|
-
Style/StringLiteralsInInterpolation:
|
|
31
|
-
EnforcedStyle: double_quotes
|
data/.tm_properties
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
excludeInFolderSearch = "{$excludeInFolderSearch,coverage,doc}"
|