diff --git a/Dockerfile b/Dockerfile index 55f5e0e..67c9915 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,6 +35,7 @@ WORKDIR /siwe-oidc RUN mkdir -p ./static COPY --from=node_builder /siwe-oidc/static/ ./static/ COPY --from=builder /siwe-oidc/siwe-oidc.toml ./ +ENV SIWEOIDC_ADDRESS="0.0.0.0" EXPOSE 8000 ENTRYPOINT ["siwe-oidc"] LABEL org.opencontainers.image.source https://github.com/spruceid/siwe-oidc diff --git a/README.md b/README.md index 7b51450..fa5dfec 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Redis, or a Redis compatible database (e.g. MemoryDB in AWS), is required. The Docker image is available at `ghcr.io/spruceid/siwe_oidc:0.1.0`. Here is an example usage: ```bash -docker run -p 8000:8000 -e SIWEOIDC_ADDRESS="0.0.0.0" -e SIWEOIDC_REDIS_URL="redis://redis" ghcr.io/spruceid/siwe_oidc:latest +docker run -p 8000:8000 -e SIWEOIDC_REDIS_URL="redis://redis" ghcr.io/spruceid/siwe_oidc:latest ``` It can be configured either with the `siwe-oidc.toml` configuration file, or diff --git a/docker-compose.yml b/docker-compose.yml index 79d971d..a1663ca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,17 +10,18 @@ services: # Need siwe-oidc in /etc/hosts for localhost to allow both the host and Keycloak to reach the IdP SIWEOIDC_BASE_URL: "http://siwe-oidc:8000/" SIWEOIDC_REDIS_URL: "redis://redis" - SIWEOIDC_DEFAULT_CLIENTS: '{sdf="sdf"}' + SIWEOIDC_DEFAULT_CLIENTS: '{sdf="{\"secret\":\"sdf\", \"metadata\": {\"redirect_uris\": [\"http://localhost:8080/realms/master/broker/oidc/endpoint\"]}}"}' RUST_LOG: "siwe_oidc=debug,tower_http=debug" keycloak: - image: quay.io/keycloak/keycloak:latest + image: quay.io/keycloak/keycloak:19.0.1 ports: - "8080:8080" + command: "start-dev" + # network_mode: "host" environment: - DB_VENDOR: H2 - KEYCLOAK_USER: admin - KEYCLOAK_PASSWORD: admin + KEYCLOAK_ADMIN: admin + KEYCLOAK_ADMIN_PASSWORD: admin redis: image: redis:6-alpine diff --git a/src/axum_lib.rs b/src/axum_lib.rs index fefa051..c7194ca 100644 --- a/src/axum_lib.rs +++ b/src/axum_lib.rs @@ -248,20 +248,17 @@ pub async fn main() { let manager = RedisConnectionManager::new(config.redis_url.clone()).unwrap(); let pool = bb8::Pool::builder().build(manager.clone()).await.unwrap(); - // let pool2 = bb8::Pool::builder().build(manager).await.unwrap(); let redis_client = RedisClient { pool }; - // for (id, secret) in &config.default_clients.clone() { - // let client_entry = ClientEntry { - // secret: secret.to_string(), - // redirect_uris: vec![], - // }; - // redis_client - // .set_client(id.to_string(), client_entry) - // .await - // .unwrap(); // TODO - // } + for (id, entry) in &config.default_clients.clone() { + let entry: ClientEntry = + serde_json::from_str(entry).expect("Deserialisation of ClientEntry failed"); + redis_client + .set_client(id.to_string(), entry.clone()) + .await + .unwrap(); // TODO + } let private_key = if let Some(key) = &config.rsa_pem { RsaPrivateKey::from_pkcs1_pem(key)