mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-10 07:06:53 +00:00
add iam system
add iam store feat: add crypto crate introduce decrypt_data and encrypt_data functions Signed-off-by: bestgopher <84328409@qq.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
use time::OffsetDateTime;
|
||||
|
||||
use super::{decode::decode, encode::encode};
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
let claims = serde_json::json!({
|
||||
"exp": OffsetDateTime::now_utc().unix_timestamp() + 1000,
|
||||
"aaa": 1,
|
||||
"bbb": "bbb"
|
||||
});
|
||||
|
||||
let jwt_token = encode(b"aaaa", &claims).unwrap();
|
||||
let new_claims = decode(&jwt_token, b"aaaa").unwrap();
|
||||
assert_eq!(new_claims.claims, claims);
|
||||
}
|
||||
Reference in New Issue
Block a user