Skip to content

Commit 4eaa263

Browse files
committed
Improve documentation and add request flow diagram
1 parent 6b9acc8 commit 4eaa263

File tree

7 files changed

+214
-5
lines changed

7 files changed

+214
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "nginx-auth-server"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
authors = ["Steffen Manzer"]
55
edition = '2024'
66

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
This is a **small and lightweight** http server, to be used by nginx to authenticate users against linux system users via PAM and an auxiliary totp file with `ngx_http_auth_request_module`.
44

5+
## Request flow
6+
7+
![Request flow diagram](docs/nginx-auth-request.svg)
8+
59
## Scope and code quality
610

711
### Project goals

docs/nginx-auth-request.drawio

Lines changed: 203 additions & 0 deletions
Large diffs are not rendered by default.

docs/nginx-auth-request.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
proxy_set_header Remote-User $auth_user;
1+
# Include this snippet in your `location`-block to implement Single-Sign-On for reverse proxy use cases
2+
proxy_set_header Remote-User $auth_user;

examples/etc/nginx/snippets/auth.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ auth_request_set $auth_user $upstream_http_remote_user;
2525
add_header Remote-User $auth_user always;
2626
error_page 401 $scheme://$host/auth/;
2727

28-
# To implement Single-Sign-On: Add to location-Block:
28+
# To implement Single-Sign-On for reverse proxy use cases: Add to location-Block:
2929
# include /etc/nginx/snippets/auth-sso.conf;
3030
# or
3131
# proxy_set_header Remote-User $auth_user;

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ async fn main() {
8989
}
9090

9191
let app = Router::new()
92-
.route("/auth/check", get(check_login))
92+
.route("/auth/check", get(check_session))
9393
.route("/auth/login", post(handle_login))
9494
.with_state(sessions.into())
9595
;
@@ -100,7 +100,7 @@ async fn main() {
100100
}
101101

102102
/// Internal session / auth check, used by nginx
103-
async fn check_login(
103+
async fn check_session(
104104
State(sessions): State<Arc<SessionStore>>,
105105
jar: CookieJar,
106106
) -> Response

0 commit comments

Comments
 (0)