Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions crates/aionui-auth/src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,7 @@ pub fn auth_routes(state: AuthRouterState) -> Router {
let auth_state = AuthState {
jwt_service: state.jwt_service.clone(),
user_repo: state.user_repo.clone(),
identity_mode: if state.aionpro_mode {
AuthIdentityMode::AionPro
} else {
AuthIdentityMode::UserSession
},
identity_mode: state.identity_mode,
// Auth endpoints manage sessions themselves; the helper CLI never
// calls them, so the runtime-token channel stays disabled here.
runtime_token_verifier: None,
Expand Down
14 changes: 14 additions & 0 deletions crates/aionui-auth/tests/route_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,20 @@ async fn t7_3_get_user_no_token() {
assert_eq!(json["code"], "UNAUTHORIZED");
}

#[tokio::test]
async fn t7_4_get_user_local_mode_without_token() {
let (app, _ctx) = test_app_with_local(true).await;

let req = get_anonymous("/api/auth/user");
let resp = app.oneshot(req).await.unwrap();

assert_eq!(resp.status(), StatusCode::OK);
let json = body_json(resp).await;
assert_eq!(json["success"], true);
assert_eq!(json["user"]["id"], "system_default_user");
assert_eq!(json["user"]["username"], "system_default_user");
}

// ===========================================================================
// T8. Change Password (POST /api/auth/change-password)
// ===========================================================================
Expand Down