Skip to content

refactor(auth): centralize credential storage - #236

Merged
un-lock-able merged 4 commits into
stack-rs:auth-enhancementfrom
YuMo12268:credential-store
Jul 29, 2026
Merged

refactor(auth): centralize credential storage#236
un-lock-able merged 4 commits into
stack-rs:auth-enhancementfrom
YuMo12268:credential-store

Conversation

@YuMo12268

@YuMo12268 YuMo12268 commented Jul 25, 2026

Copy link
Copy Markdown

Summary

  • Introduce a crate-private CredentialStore to centralize credential path resolution and file operations.
  • Route Client and Worker JWT cache reads, writes, updates, and removals through CredentialStore.
  • Store cached JWTs in a readable normalized_origin,username,token format.
  • Scope cached JWTs by normalized Coordinator origin and username.
  • Preserve the existing authentication flow and token encoding.
  • Do not persist login passwords.
  • Initialize the Client credential store during MitoHttpClient construction and share a single credential-loading path between Client and Worker.

Validation

  • Added unit tests verifying that:
    • trailing-slash and default-port aliases normalize to the same Coordinator origin;
    • different schemes, hosts, and non-default ports remain distinct;
    • paths, queries, and fragments do not affect Coordinator identity;
    • comma-separated credential entries are parsed correctly.
  • Manually verified that:
    • cached tokens use the readable three-field format;
    • cached authentication reuses the existing token without falling back to login;
    • trailing-slash aliases reuse the same cached credential;
    • refresh updates the cached token without appending another record;
    • revoke removes the matching cached token.

Comment thread netmito/src/service/auth/credential_store.rs Outdated
Comment thread netmito/src/service/auth/credential_store.rs Outdated
Comment thread netmito/src/service/auth/cred.rs Outdated
Comment thread netmito/src/service/auth/credential_store.rs Outdated
Comment thread netmito/src/service/auth/credential_store.rs Outdated
@YuMo12268
YuMo12268 requested a review from un-lock-able July 29, 2026 03:33
Comment thread netmito/src/client/http.rs Outdated
Comment thread netmito/src/service/auth/cred.rs Outdated
@un-lock-able

Copy link
Copy Markdown

Please remember to rebase this branch onto the updated auth-enhancement branch.

@un-lock-able
un-lock-able merged commit d88aefa into stack-rs:auth-enhancement Jul 29, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants