5 releases

0.2.2 Jun 5, 2024
0.2.1 Jun 4, 2024
0.2.0 Jun 4, 2024
0.1.1 Jun 4, 2024
0.1.0 Jun 4, 2024

#679 in Authentication

MIT license

10KB
111 lines

cc-auth

crates.io MIT licensed docs.rs

Simple backend authorization system.

Simple usage example

use bb8_redis::{RedisConnectionManager, bb8::Pool};
use cc_auth::{ApiToken, check_token};
use cc_utils::prelude::MResult;

pub async fn authorized_action(
  cacher: &Pool<RedisConnectionManager>,
  token: ApiToken,
) -> MResult<()> {
  let user_id = check_token(&token, cacher).await?;
  Ok(())
}

lib.rs:

Crate that implementing simple authorization system.

CC Auth uses passwords' hashing with salts, SHA3-256 hash function and Redis-like tokens' storage.

Usage:

use bb8_redis::{RedisConnectionManager, bb8::Pool};
use cc_auth::{ApiToken, check_token};
use cc_utils::prelude::MResult;

pub async fn authorized_action(
  cacher: &Pool<RedisConnectionManager>,
  token: ApiToken,
) -> MResult<()> {
  let user_id = check_token(&token, cacher).await?;
  Ok(())
}

Dependencies

~3–20MB
~309K SLoC