Skip to content

Enhance token authentication mechanism - #229

Merged
un-lock-able merged 5 commits into
devfrom
auth-enhancement
Jul 31, 2026
Merged

Enhance token authentication mechanism#229
un-lock-able merged 5 commits into
devfrom
auth-enhancement

Conversation

@un-lock-able

Copy link
Copy Markdown

This PR adds two new features:

  1. Allow the user to specify the expriry time of a worker token upon worker startup, and allow a worker token to valid forever;
  2. Make retaining the token the default behavior when user logs in, and adds refresh command to request a new token, a revoke command to revoke all tokens.

@un-lock-able
un-lock-able requested a review from BobAnkh July 15, 2026 04:25

@BobAnkh BobAnkh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's first align the following things and then I will review the rest of the code. Also, please update all relevant documents.

Comment thread guide/src/guide/client.md Outdated
Comment thread netmito/src/schema.rs Outdated
Comment thread netmito/src/schema.rs Outdated
@un-lock-able

Copy link
Copy Markdown
Author

@BobAnkh I have removed the custom serde functions and now worker's lifetime is default to None, and user can override the setting by cmd or config file.

@BobAnkh BobAnkh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to improve the credential system. We might wait for the feature of address storage cred system to merge together.

Comment thread netmito/src/service/auth/token.rs
Comment thread netmito/src/service/auth/token.rs Outdated
Comment thread netmito/src/client/http.rs
Comment thread netmito/src/client/http.rs Outdated
Comment thread netmito/src/client/mod.rs Outdated
@un-lock-able
un-lock-able force-pushed the auth-enhancement branch 3 times, most recently from d8f3851 to a8f502e Compare July 20, 2026 07:19
Comment thread netmito/src/service/auth/mod.rs Outdated
Comment thread netmito/src/service/auth/mod.rs
self.rewrite(&origin, username, None).await
}

async fn read(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is a little bit weird and needs modification.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need some discussion on that before any changes are taken.

}

if new_lines.is_empty() {
tokio::fs::remove_file(&self.credential_path).await?;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we doesn't need to remove the file. We could just keep it empty, so just use the original code we already have in our modify_or_append_credential function, that is, write the content joined by "\n", as in your else block.

YuMo12268 and others added 4 commits July 31, 2026 15:01
Co-authored-by: un-lock-able <gaogao174561@outlook.com>
Co-authored-by: un-lock-able <gaogao174561@outlook.com>
Co-authored-by: BobAnkh <bobankhshen@gmail.com>
@un-lock-able
un-lock-able merged commit 1afa08c into dev Jul 31, 2026
11 checks passed
@un-lock-able
un-lock-able deleted the auth-enhancement branch July 31, 2026 07:03
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.

3 participants