Skip to content

Commit

Permalink
EDGAR: Issue-132 - Edgar uses client secret and client id from provid…
Browse files Browse the repository at this point in the history
…ed setup string and writes those information in its toml file if they are not existent yet.
  • Loading branch information
mtwardawski authored and voelkera committed Apr 15, 2024
1 parent 8620c3f commit 1d78272
Show file tree
Hide file tree
Showing 17 changed files with 270 additions and 82 deletions.
4 changes: 2 additions & 2 deletions .ci/docker/carl/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ services:
- OPENDUT_CARL_OPENTELEMETRY_ENDPOINT=http://otel-collector:4317
# OIDC
- OPENDUT_CARL_NETWORK_OIDC_ENABLED=true
- OPENDUT_CARL_NETWORK_OIDC_CLIENT_CLIENT_ID=opendut-carl-client
- OPENDUT_CARL_NETWORK_OIDC_CLIENT_CLIENT_SECRET=6754d533-9442-4ee6-952a-97e332eca38e
- OPENDUT_CARL_NETWORK_OIDC_CLIENT_ID=opendut-carl-client
- OPENDUT_CARL_NETWORK_OIDC_CLIENT_SECRET=6754d533-9442-4ee6-952a-97e332eca38e
- OPENDUT_CARL_NETWORK_OIDC_CLIENT_PEER_ID=opendut-edgar-client
- OPENDUT_CARL_NETWORK_OIDC_CLIENT_PEER_SECRET=c7d6ace0-b90f-471a-bb62-a4ecac4150f8
- OPENDUT_CARL_NETWORK_OIDC_CLIENT_ISSUER_URL=https://keycloak/realms/opendut/
Expand Down
16 changes: 8 additions & 8 deletions .ci/docker/edgar/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ services:
- OPENDUT_CLEO_NETWORK_CARL_PORT=443
- OPENDUT_CLEO_NETWORK_TLS_DOMAIN_NAME_OVERRIDE=carl # default developer certificate is only valid for localhost
- OPENDUT_CLEO_NETWORK_OIDC_ENABLED=true
- OPENDUT_CLEO_NETWORK_OIDC_CLIENT_CLIENT_ID=opendut-cleo-client
- OPENDUT_CLEO_NETWORK_OIDC_CLIENT_CLIENT_SECRET=918642e0-4ec4-4ef5-8ae0-ba92de7da3f9
- OPENDUT_CLEO_NETWORK_OIDC_CLIENT_ID=opendut-cleo-client
- OPENDUT_CLEO_NETWORK_OIDC_CLIENT_SECRET=918642e0-4ec4-4ef5-8ae0-ba92de7da3f9
- OPENDUT_CLEO_NETWORK_OIDC_CLIENT_ISSUER_URL=https://keycloak/realms/opendut/
- OPENDUT_CLEO_NETWORK_OIDC_CLIENT_SCOPES=

Expand All @@ -31,8 +31,8 @@ services:
- OPENDUT_EDGAR_NETWORK_CARL_PORT=443
- OPENDUT_EDGAR_NETWORK_TLS_DOMAIN_NAME_OVERRIDE=carl # default developer certificate is only valid for localhost
- OPENDUT_EDGAR_NETWORK_OIDC_ENABLED=true
- OPENDUT_EDGAR_NETWORK_OIDC_CLIENT_CLIENT_ID=opendut-edgar-client
- OPENDUT_EDGAR_NETWORK_OIDC_CLIENT_CLIENT_SECRET=c7d6ace0-b90f-471a-bb62-a4ecac4150f8
- OPENDUT_EDGAR_NETWORK_OIDC_CLIENT_ID=opendut-edgar-client
- OPENDUT_EDGAR_NETWORK_OIDC_CLIENT_SECRET=c7d6ace0-b90f-471a-bb62-a4ecac4150f8
- OPENDUT_EDGAR_NETWORK_OIDC_CLIENT_ISSUER_URL=https://keycloak/realms/opendut/
- OPENDUT_EDGAR_NETWORK_OIDC_CLIENT_SCOPES=
- OPENDUT_EDGAR_OPENTELEMETRY_ENABLED=true
Expand Down Expand Up @@ -73,8 +73,8 @@ services:
- OPENDUT_CLEO_NETWORK_CARL_PORT=443
- OPENDUT_CLEO_NETWORK_TLS_DOMAIN_NAME_OVERRIDE=carl # default developer certificate is only valid for localhost
- OPENDUT_CLEO_NETWORK_OIDC_ENABLED=true
- OPENDUT_CLEO_NETWORK_OIDC_CLIENT_CLIENT_ID=opendut-cleo-client
- OPENDUT_CLEO_NETWORK_OIDC_CLIENT_CLIENT_SECRET=918642e0-4ec4-4ef5-8ae0-ba92de7da3f9
- OPENDUT_CLEO_NETWORK_OIDC_CLIENT_ID=opendut-cleo-client
- OPENDUT_CLEO_NETWORK_OIDC_CLIENT_SECRET=918642e0-4ec4-4ef5-8ae0-ba92de7da3f9
- OPENDUT_CLEO_NETWORK_OIDC_CLIENT_ISSUER_URL=https://keycloak/realms/opendut/
- OPENDUT_CLEO_NETWORK_OIDC_CLIENT_SCOPES=

Expand All @@ -83,8 +83,8 @@ services:
- OPENDUT_EDGAR_NETWORK_CARL_PORT=443
- OPENDUT_EDGAR_NETWORK_TLS_DOMAIN_NAME_OVERRIDE=carl # default developer certificate is only valid for localhost
- OPENDUT_EDGAR_NETWORK_OIDC_ENABLED=true
- OPENDUT_EDGAR_NETWORK_OIDC_CLIENT_CLIENT_ID=opendut-edgar-client
- OPENDUT_EDGAR_NETWORK_OIDC_CLIENT_CLIENT_SECRET=c7d6ace0-b90f-471a-bb62-a4ecac4150f8
- OPENDUT_EDGAR_NETWORK_OIDC_CLIENT_ID=opendut-edgar-client
- OPENDUT_EDGAR_NETWORK_OIDC_CLIENT_SECRET=c7d6ace0-b90f-471a-bb62-a4ecac4150f8
- OPENDUT_EDGAR_NETWORK_OIDC_CLIENT_ISSUER_URL=https://keycloak/realms/opendut/
- OPENDUT_EDGAR_NETWORK_OIDC_CLIENT_SCOPES=
- OPENDUT_EDGAR_OPENTELEMETRY_ENABLED=true
Expand Down
4 changes: 2 additions & 2 deletions .ci/docker/theo/src/core/resources/carl.environment.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ OPENDUT_CARL_NETWORK_TLS_KEY=resources/development/tls/carl.key
OPENDUT_CARL_NETWORK_TLS_CA=resources/development/tls/insecure-development-ca.pem

OPENDUT_CARL_NETWORK_OIDC_ENABLED=true
OPENDUT_CARL_NETWORK_OIDC_CLIENT_CLIENT_ID=opendut-carl-client
OPENDUT_CARL_NETWORK_OIDC_CLIENT_CLIENT_SECRET=6754d533-9442-4ee6-952a-97e332eca38e
OPENDUT_CARL_NETWORK_OIDC_CLIENT_ID=opendut-carl-client
OPENDUT_CARL_NETWORK_OIDC_CLIENT_SECRET=6754d533-9442-4ee6-952a-97e332eca38e
OPENDUT_CARL_NETWORK_OIDC_CLIENT_ISSUER_URL=http://localhost:8081/realms/opendut/
OPENDUT_CARL_NETWORK_OIDC_CLIENT_ISSUER_REMOTE_URL=https://keycloak/realms/opendut/
OPENDUT_CARL_NETWORK_OIDC_CLIENT_SCOPES=""
Expand Down
4 changes: 2 additions & 2 deletions .ci/docker/theo/src/core/resources/carl.toml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ ca = "resources/development/tls/insecure-development-ca.pem"
enabled = true

[network.oidc.client]
client.id = "opendut-carl-client"
client.secret = "6754d533-9442-4ee6-952a-97e332eca38e"
id = "opendut-carl-client"
secret = "6754d533-9442-4ee6-952a-97e332eca38e"
issuer.url = "http://localhost:8081/realms/opendut/"
issuer.remote.url = "https://keycloak/realms/opendut/"
scopes = ""
Expand Down
4 changes: 2 additions & 2 deletions opendut-carl/carl.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ ca = "/etc/opendut/tls/ca.pem"
enabled = false

[network.oidc.client]
client.id = "tbd"
client.secret = "tbd"
id = "tbd"
secret = "tbd"
# issuer url that CARL uses
issuer.url = "https://keycloak/realms/opendut/"
# issuer url that CARL tells the clients to use (required in test environment)
Expand Down
4 changes: 2 additions & 2 deletions opendut-carl/opendut-carl-api/src/carl/auth/auth_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ pub struct OidcIdentityProviderConfig {

const OIDC_CLIENT_CONFIG_PREFIX: &str = "network.oidc.client";
impl OidcIdentityProviderConfig {
const CLIENT_ID: &'static str = formatcp!("{OIDC_CLIENT_CONFIG_PREFIX}.client.id");
const CLIENT_SECRET: &'static str = formatcp!("{OIDC_CLIENT_CONFIG_PREFIX}.client.secret");
const CLIENT_ID: &'static str = formatcp!("{OIDC_CLIENT_CONFIG_PREFIX}.id");
const CLIENT_SECRET: &'static str = formatcp!("{OIDC_CLIENT_CONFIG_PREFIX}.secret");
const ISSUER_URL: &'static str = formatcp!("{OIDC_CLIENT_CONFIG_PREFIX}.issuer.url");
const SCOPES: &'static str = formatcp!("{OIDC_CLIENT_CONFIG_PREFIX}.scopes");

Expand Down
2 changes: 1 addition & 1 deletion opendut-carl/src/actions/peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ pub async fn generate_peer_setup(params: GeneratePeerSetupParams) -> Result<Peer

let auth_config = match params.oidc_client_manager {
None => {
AuthConfig::disabled()
AuthConfig::Disabled
}
Some(oidc_client_manager) => {
debug!("Generating OIDC client for peer '{peer_name}' <{peer_id}>.");
Expand Down
4 changes: 2 additions & 2 deletions opendut-carl/src/peer/oidc_client_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ impl TryFrom<&Config> for CarlIdentityProviderConfig {
}

impl CarlIdentityProviderConfig {
const CLIENT_ID: &'static str = formatcp!("{CARL_OIDC_CONFIG_PREFIX}.client.id");
const CLIENT_SECRET: &'static str = formatcp!("{CARL_OIDC_CONFIG_PREFIX}.client.secret");
const CLIENT_ID: &'static str = formatcp!("{CARL_OIDC_CONFIG_PREFIX}.id");
const CLIENT_SECRET: &'static str = formatcp!("{CARL_OIDC_CONFIG_PREFIX}.secret");
const COMMON_PEER_ID: &'static str = formatcp!("{CARL_OIDC_CONFIG_PREFIX}.peer.id");
const COMMON_PEER_SECRET: &'static str = formatcp!("{CARL_OIDC_CONFIG_PREFIX}.peer.secret");
const ISSUER_URL: &'static str = formatcp!("{CARL_OIDC_CONFIG_PREFIX}.issuer.url");
Expand Down
2 changes: 1 addition & 1 deletion opendut-cleo/cleo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ enabled = false

[network.oidc.client]
id = "opendut-cleo-client"
issuer_url = "https://keycloak/realms/opendut/"
issuer.url = "https://keycloak/realms/opendut/"
scopes = "openid,profile,email,roles,groups"
secret = "<tbd>"
2 changes: 1 addition & 1 deletion opendut-edgar/edgar.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ enabled = false

[network.oidc.client]
id = "opendut-edgar-client"
issuer_url = "https://keycloak/realms/opendut/"
issuer.url = "https://keycloak/realms/opendut/"
scopes = "openid,profile,email,roles,groups"
secret = "<tbd>"

Expand Down
11 changes: 7 additions & 4 deletions opendut-edgar/src/setup/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ pub async fn managed(run_mode: RunMode, no_confirm: bool, setup_string: String,
let mut tasks: Vec<Box<dyn Task>> = vec![
Box::new(tasks::WriteCaCertificate { certificate: peer_setup.ca }),
Box::new(tasks::CheckOsRequirements),
Box::new(tasks::WriteConfiguration::with_override(write_configuration::ConfigOverride {
peer_id: peer_setup.id,
carl_url: peer_setup.carl,
})),
Box::new(tasks::WriteConfiguration::with_override(
write_configuration::ConfigOverride {
peer_id: peer_setup.id,
carl_url: peer_setup.carl,
auth_config: peer_setup.auth_config,
}),
),
Box::new(tasks::CheckCarlReachable),
Box::new(tasks::CopyExecutable),
Box::new(tasks::LoadKernelModules::default()),
Expand Down
Loading

0 comments on commit 1d78272

Please sign in to comment.