actix-web-middleware-keycloak-auth

Crates.ioactix-web-middleware-keycloak-auth
lib.rsactix-web-middleware-keycloak-auth
version0.5.0
sourcesrc
created_at2020-11-25 18:17:19.942793
updated_at2024-09-29 10:11:10.004569
descriptionA middleware for Actix Web that handles authentication with a JWT emitted by Keycloak
homepage
repositoryhttps://github.com/dsferruzza/actix-web-middleware-keycloak-auth
max_upload_size
id316375
size145,860
David Sferruzza (dsferruzza)

documentation

https://docs.rs/actix-web-middleware-keycloak-auth

README

actix-web-middleware-keycloak-auth

LICENSE Build and test Lint Crates.io Version Documentation

A middleware for Actix Web that handles authentication with a JWT emitted by Keycloak.

Features

  • Actix Web middleware
  • deny HTTP requests that do not provide a valid JWT (or choose to allow them and handle the authentication state from a following middleware)
  • require one or several Keycloak realm or client roles to be included in the JWT
  • error HTTP responses sent from the middleware can have generic bodies as well as detailed error reasons
  • access JWT claims from handlers (for example: get the ID of the authenticated user)
  • parse custom JWT claims (using Serde)
  • access parsed roles from handlers (every Keycloak role contained in the JWT)
  • compatible with paperclip using the paperclip_compat feature
  • store auth status in request-local data instead of returning a HTTP response (so that the next middleware/handler can try another auth mechanism, for example)

Usage

License

MIT License Copyright (c) 2020 David Sferruzza

Commit count: 104

cargo fmt