Skip to main content

keycloak_sdk/
lib.rs

1//! Keycloak SDK for Rust — async OIDC auth + Admin REST.
2#![forbid(unsafe_code)]
3
4pub mod admin;
5pub mod auth;
6pub mod client;
7pub mod config;
8pub mod error;
9pub mod jwks;
10pub mod jwt;
11pub mod oidc;
12pub mod token_provider;
13pub mod tokens;
14
15// re-exports 활성화는 각 타입 구현 후(Task 2~10)
16pub use admin::AdminClient;
17pub use auth::AuthClient;
18pub use client::KeycloakClient;
19pub use config::KeycloakConfig;
20pub use error::{AdminError, KeycloakError};
21pub use jwt::JwtValidator;
22pub use oidc::OidcEndpoints;
23pub use token_provider::{ClientCredentialsTokenProvider, TokenProvider};
24pub use tokens::{AuthorizationRequest, IntrospectionResult, TokenSet, ValidatedToken};
25
26// ── 하위 crate 타입 재노출 ──
27// 공개 API가 실제로 받거나 돌려주는 foreign 타입만 재노출한다(§4(b) 문서화된 은닉성 예외).
28// 이게 없으면 소비자가 `keycloak`/`reqwest`를 자기 Cargo.toml에 버전까지 맞춰 직접 추가해야만
29// admin 파사드를 호출할 수 있다(공개 퀵스타트가 그대로는 컴파일되지 않는다).
30
31/// The representation types that the admin facade exposes, unchanged, as its data model (a mirror of `keycloak::types`).
32/// These are all five that appear in admin.rs's public signatures.
33pub mod types {
34    pub use keycloak::types::{
35        ClientRepresentation, GroupRepresentation, RealmRepresentation, RoleRepresentation,
36        UserRepresentation,
37    };
38}
39
40// `AdminClient::raw()`의 반환 타입 `&KeycloakAdmin<SdkTokenSupplier>`를 이름 붙이는 데 필요한 둘
41// (`KeycloakAdmin`은 foreign, `SdkTokenSupplier`는 우리 것이지만 루트에 없었다).
42pub use admin::SdkTokenSupplier;
43pub use keycloak::KeycloakAdmin;
44// 저수준 주입 지점(`AdminClient::new`·`AuthClient::new`·`ClientCredentialsTokenProvider::new`·
45// `JwksStore::new`)이 받는 공유 HTTP 클라이언트 — SDK가 실제로 쓰는 crate를 그대로 재노출한다.
46pub use reqwest;
47// `raw()` 로 얻은 `KeycloakAdmin` 의 **모든** 메서드가 돌려주는 오류다. 루트의 `KeycloakError`
48// 는 **우리 타입**이라 이름이 겹치므로 별칭으로 낸다 — 별칭이 없으면 `raw()` 소비자는 오류를
49// 이름 붙일 수 없어 `keycloak` crate 를 자기 Cargo.toml 에 직접 넣어야 한다(재노출이 막으려던 그것).
50pub use keycloak::KeycloakError as RawKeycloakError;
51// `JwksStore::get_key()` 가 돌려주는 JWK. `jwks` 는 `pub mod` 이고 `JwksStore::new` 는 문서화된
52// 저수준 주입 지점이라, 이 타입은 공개 표면에 실재한다(감사 실측 2026-09-22).
53pub use jsonwebtoken::jwk::Jwk;