Update dev setup

This commit is contained in:
Simon Bihel 2022-08-19 11:36:36 +01:00
parent 5ae46af107
commit d8251bdb59
No known key found for this signature in database
GPG Key ID: B7013150BEAA28FD
4 changed files with 16 additions and 17 deletions

View File

@ -35,6 +35,7 @@ WORKDIR /siwe-oidc
RUN mkdir -p ./static RUN mkdir -p ./static
COPY --from=node_builder /siwe-oidc/static/ ./static/ COPY --from=node_builder /siwe-oidc/static/ ./static/
COPY --from=builder /siwe-oidc/siwe-oidc.toml ./ COPY --from=builder /siwe-oidc/siwe-oidc.toml ./
ENV SIWEOIDC_ADDRESS="0.0.0.0"
EXPOSE 8000 EXPOSE 8000
ENTRYPOINT ["siwe-oidc"] ENTRYPOINT ["siwe-oidc"]
LABEL org.opencontainers.image.source https://github.com/spruceid/siwe-oidc LABEL org.opencontainers.image.source https://github.com/spruceid/siwe-oidc

View File

@ -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 The Docker image is available at `ghcr.io/spruceid/siwe_oidc:0.1.0`. Here is an
example usage: example usage:
```bash ```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 It can be configured either with the `siwe-oidc.toml` configuration file, or

View File

@ -10,17 +10,18 @@ services:
# Need siwe-oidc in /etc/hosts for localhost to allow both the host and Keycloak to reach the IdP # 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_BASE_URL: "http://siwe-oidc:8000/"
SIWEOIDC_REDIS_URL: "redis://redis" 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" RUST_LOG: "siwe_oidc=debug,tower_http=debug"
keycloak: keycloak:
image: quay.io/keycloak/keycloak:latest image: quay.io/keycloak/keycloak:19.0.1
ports: ports:
- "8080:8080" - "8080:8080"
command: "start-dev"
# network_mode: "host"
environment: environment:
DB_VENDOR: H2 KEYCLOAK_ADMIN: admin
KEYCLOAK_USER: admin KEYCLOAK_ADMIN_PASSWORD: admin
KEYCLOAK_PASSWORD: admin
redis: redis:
image: redis:6-alpine image: redis:6-alpine

View File

@ -248,20 +248,17 @@ pub async fn main() {
let manager = RedisConnectionManager::new(config.redis_url.clone()).unwrap(); let manager = RedisConnectionManager::new(config.redis_url.clone()).unwrap();
let pool = bb8::Pool::builder().build(manager.clone()).await.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 }; let redis_client = RedisClient { pool };
// for (id, secret) in &config.default_clients.clone() { for (id, entry) in &config.default_clients.clone() {
// let client_entry = ClientEntry { let entry: ClientEntry =
// secret: secret.to_string(), serde_json::from_str(entry).expect("Deserialisation of ClientEntry failed");
// redirect_uris: vec![], redis_client
// }; .set_client(id.to_string(), entry.clone())
// redis_client .await
// .set_client(id.to_string(), client_entry) .unwrap(); // TODO
// .await }
// .unwrap(); // TODO
// }
let private_key = if let Some(key) = &config.rsa_pem { let private_key = if let Some(key) = &config.rsa_pem {
RsaPrivateKey::from_pkcs1_pem(key) RsaPrivateKey::from_pkcs1_pem(key)