This project is a sample user management and authentication system that adopts Rust and serverless architecture.
See template.yaml
If your First time to install the Rust toolchain, you can use the following command.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
After installing the Rust toolchain, check the version.
This project uses the following version.
rustup -V
rustup 1.27.1 (2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.80.1 (3f5fd8dd4 2024-08-06)`
cargo version
cargo 1.80.1 (376290515 2024-07-16)
cargo install --force cargo-make
brew tap cargo-lambda/cargo-lambda
brew install cargo-lambda
brew install filosottile/musl-cross/musl-cross
rustup target add aarch64-unknown-linux-musl
If your build fails with the openssl related error, try to set the environment variables like this
export OPENSSL_DIR=$(brew --prefix openssl@3)
export OPENSSL_LIB_DIR=$(brew --prefix openssl@3)/lib
export OPENSSL_INCLUDE_DIR=$(brew --prefix openssl@3)/include
export PKG_CONFIG_PATH=$(brew --prefix openssl@3)/lib/pkgconfig
Set AWS credentials in you local.
brew install aws-sam-cli
This project uses the cargo-make
for the build and the deployment.
More information, see the Makefile.toml
and https://sagiegurari.github.io/cargo-make/.
cargo make build-all
sam build --profile { your profile }
sam deploy --profile { your profile }
Set the following items as secrets manually from the Cognito User Pool Client settings in the AWS Console:
- COGNITO_USER_POOL_ID
- COGNITO_CLIENT_ID
- COGNITO_CLIENT_SECRET
- COGNITO_JWKS_URL
In addition, please create the secret with the name {Env}/UserManagementAuthApi/CognitoEnv
.
POST /signup
POST /login
POST /tokens/refresh
GET /tokens/validate
GET /organizations/{organizationId}/users
POST /organizations/{organizationId}/users
GET /organizations/{organizationId}/users/{userId}
PUT /organizations/{organizationId}/users/{userId}
DELETE /organizations/{organizationId}/users/{userId}