{"id":16554711,"url":"https://github.com/owez/axum-auth","last_synced_at":"2025-04-04T19:13:34.694Z","repository":{"id":42038786,"uuid":"474776387","full_name":"Owez/axum-auth","owner":"Owez","description":"High-level http auth extractors for axum","archived":false,"fork":false,"pushed_at":"2024-02-28T20:51:32.000Z","size":63,"stargazers_count":98,"open_issues_count":2,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-12T19:52:02.994Z","etag":null,"topics":["auth","axum","bearer","rust","web"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Owez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-27T22:35:28.000Z","updated_at":"2024-10-02T04:22:51.000Z","dependencies_parsed_at":"2024-06-21T16:43:17.239Z","dependency_job_id":"6691573c-9bea-47bd-ba0e-db0f16392a06","html_url":"https://github.com/Owez/axum-auth","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Owez%2Faxum-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Owez%2Faxum-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Owez%2Faxum-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Owez%2Faxum-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Owez","download_url":"https://codeload.github.com/Owez/axum-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234923,"owners_count":20905854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auth","axum","bearer","rust","web"],"created_at":"2024-10-11T19:52:08.357Z","updated_at":"2025-04-04T19:13:34.668Z","avatar_url":"https://github.com/Owez.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auth for axum\n\nHigh-level [http auth](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication) extractors for [axum](https://github.com/tokio-rs/axum)\n\n🚨 This crate provides an alternative to `TypedHeader\u003cAuthorization\u003c..\u003e\u003e` which you may [use](https://docs.rs/axum-extra/latest/axum_extra/struct.TypedHeader.html) instead. Take a look at the fantastic [axum-login](https://github.com/maxcountryman/axum-login) crate if your looking for more robust session management. I will continue to maintain this crate.\n\n## Usage\n\nBearer Authentication:\n\n```rust\nuse axum_auth::AuthBearer;\n \n/// Handler for a typical axum route, takes a `token` and returns it\nasync fn handler(AuthBearer(token): AuthBearer) -\u003e String {\n    format!(\"Found a bearer token: {}\", token)\n}\n```\n\nBasic Authentication:\n\n```rust\nuse axum_auth::AuthBasic;\n \n/// Takes basic auth details and shows a message\nasync fn handler(AuthBasic((id, password)): AuthBasic) -\u003e String {\n    if let Some(password) = password {\n        format!(\"User '{}' with password '{}'\", id, password)\n    } else {\n        format!(\"User '{}' without password\", id)\n    }\n}\n```\n\nYou can also define custom extractors, letting you return custom extractors, status codes, and messages to users if the auth fails. Check out the [crate documentation](https://docs.rs/axum-auth) for more in-depth information into how everything works!\n\n## Installation\n\nSimply place the following inside of your `Cargo.toml` file for axum:\n\n```toml\n[dependencies]\naxum-auth = \"0.8\"\n```\n\nOur version follows axum since 0.7. You can also enable just basic/bearer auth via features. To enable just basic auth, you can add this to the `Cargo.toml` file instead:\n\n```toml\n[dependencies]\naxum-auth = { version = \"0.8\", default-features = false, features = [\"auth-basic\"] }\n```\n\nIf you're still using axum 0.5, use version 0.3. If you're still using axum 0.6, use version 0.4.\n\n## Security\n\nSome essential security considerations to take into account are the following:\n\n- This crate has not been audited by any security professionals. If you are willing to do or have already done an audit on this crate, please create an issue as it would help out enormously! 😊\n- This crate purposefully does not limit the maximum length of headers arriving so please ensure your webserver configurations are set properly.\n\n## Licensing\n\nThis project is dual-licensed under both the [MIT](https://github.com/Owez/argi/blob/master/LICENSE-MIT) and [Apache](https://github.com/Owez/argi/blob/master/LICENSE-APACHE), so feel free to use either at your discretion.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowez%2Faxum-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fowez%2Faxum-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowez%2Faxum-auth/lists"}