axum-oidc

A wrapper for the openidconnect crate for axum

10 unstable releases (4 breaking)

0.5.0 Sep 23, 2024
0.4.0 Apr 28, 2024
0.3.0 Mar 10, 2024
0.2.3 Jan 23, 2024
0.0.0 Nov 2, 2023
Download history 20/week @ 2024-07-15 7/week @ 2024-07-22 40/week @ 2024-07-29 83/week @ 2024-08-05 153/week @ 2024-08-12 236/week @ 2024-08-19 379/week @ 2024-08-26 246/week @ 2024-09-02 86/week @ 2024-09-09 243/week @ 2024-09-16 263/week @ 2024-09-23 136/week @ 2024-09-30 41/week @ 2024-10-07 58/week @ 2024-10-14 77/week @ 2024-10-21 40/week @ 2024-10-28

219 downloads per month

LGPL-3.0-or-later

42KB
927 lines

This Library allows using OpenID Connect with axum. It authenticates the user with the OpenID Connect Issuer and provides Extractors.

Usage

The OidcAuthLayer must be loaded on any handler that might use the extractors. The user won't be automatically logged in using this layer. If a valid session is found, the extractors will return the correct value and fail otherwise.

The OidcLoginLayer should be loaded on any handler on which the user is supposed to be authenticated. The User will be redirected to the OpenId Conect Issuer to authenticate. The extractors will always return a value.

The OidcClaims-extractor can be used to get the OpenId Conenct Claims. The OidcAccessToken-extractor can be used to get the OpenId Connect Access Token.

The OidcRpInitializedLogout-extractor can be used to get the rp initialized logout uri.

Your OIDC-Client must be allowed to redirect to every subpath of your application base url.

Examples

Take a look at the examples folder for examples.

Older Versions

All versions on crates.io are available as git tags. Additional all minor versions have their own branch (format vX.Y where X is the major and Y is the minor version) where bug fixes are implemented. Examples for each version can be found there in the previously mentioned examples folder.

Contributing

I'm happy about any contribution in any form. Feel free to submit feature requests and bug reports using a GitHub Issue. PR's are also appreciated.

License

This Library is licensed under LGPLv3.

Dependencies

~19–33MB
~528K SLoC