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
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

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
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

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
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

View File

@ -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)