Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
beltram committed Jan 10, 2024
1 parent 2bce5f9 commit 82c4359
Show file tree
Hide file tree
Showing 15 changed files with 669 additions and 1,125 deletions.
141 changes: 138 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 4 additions & 11 deletions acme/src/chall.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::prelude::*;
use jwt_simple::prelude::*;
use rusty_jwt_tools::prelude::*;

use crate::prelude::*;

impl RustyAcme {
/// client id challenge request to `POST /acme/challenge/{token}`
/// see [RFC 8555 Section 7.5.1](https://www.rfc-editor.org/rfc/rfc8555.html#section-7.5.1)
Expand Down Expand Up @@ -32,21 +32,13 @@ impl RustyAcme {
oidc_chall: AcmeChallenge,
account: &AcmeAccount,
alg: JwsAlgorithm,
hash_alg: HashAlgorithm,
kp: &Pem,
jwk: &Jwk,
previous_nonce: String,
) -> RustyAcmeResult<AcmeJws> {
// Extract the account URL from previous response which created a new account
let acct_url = account.acct_url()?;

let thumbprint = JwkThumbprint::generate(jwk, hash_alg)?.kid;
let chall_token = oidc_chall.token;
let keyauth = format!("{chall_token}.{thumbprint}");

let payload = Some(serde_json::json!({
"id_token": id_token,
"keyauth": keyauth,
}));
let req = AcmeJws::new(alg, previous_nonce, &oidc_chall.url, Some(&acct_url), payload, kp)?;
Ok(req)
Expand Down Expand Up @@ -136,10 +128,11 @@ pub enum AcmeChallengeType {

#[cfg(test)]
pub mod tests {
use super::*;
use serde_json::json;
use wasm_bindgen_test::*;

use super::*;

wasm_bindgen_test_configure!(run_in_browser);

#[test]
Expand Down
1 change: 1 addition & 0 deletions e2e-identity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ tokio = { version = "1.5", features = ["macros"], default_features = false }
lazy_static = "1.4"
portpicker = "0.1"
pem = "3.0"
keycloak = "=21.0.102"

[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
rusty-acme = { version = "0.7.1", path = "../acme" }
Expand Down
Loading

0 comments on commit 82c4359

Please sign in to comment.