Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/sea-snake/verify-google-jwt' int…
Browse files Browse the repository at this point in the history
…o sea-snake/verify-google-jwt
  • Loading branch information
sea-snake committed Jan 13, 2025
2 parents 8764a0f + 9bb803d commit 90687f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/internet_identity/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ mod archive;
mod assets;
mod authz_utils;

mod constants;
/// Type conversions between internal and external types.
mod conversions;
mod delegation;
Expand All @@ -41,7 +42,6 @@ mod state;
mod stats;
mod storage;
mod vc_mvp;
mod constants;

// Some time helpers
const fn secs_to_nanos(secs: u64) -> u64 {
Expand Down
18 changes: 5 additions & 13 deletions src/internet_identity/src/openid/google.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,9 @@ fn should_return_credential() {

#[test]
fn cert_should_be_missing() {
let (jwt, _, session_principal, session_salt, timestamp, _) =
valid_verification_test_data();
let (jwt, _, session_principal, session_salt, timestamp, _) = valid_verification_test_data();
CERTS.replace(vec![]);

assert_eq!(
verify(&jwt, &session_principal, &session_salt, timestamp),
Err("Certificate not found for dd125d5f462fbc6014aedab81ddf3bcedab70847".into())
Expand All @@ -359,8 +358,7 @@ fn signature_should_be_invalid() {

#[test]
fn issuer_should_be_invalid() {
let (_, _, session_principal, session_salt, timestamp, claims) =
valid_verification_test_data();
let (_, _, session_principal, session_salt, timestamp, claims) = valid_verification_test_data();
let mut invalid_claims = claims;
invalid_claims.iss = "invalid-issuer".into();
assert_eq!(
Expand All @@ -376,8 +374,7 @@ fn issuer_should_be_invalid() {

#[test]
fn audience_should_be_invalid() {
let (_, _, session_principal, session_salt, timestamp, claims) =
valid_verification_test_data();
let (_, _, session_principal, session_salt, timestamp, claims) = valid_verification_test_data();
let mut invalid_claims = claims;
invalid_claims.aud = "invalid-audience".into();
assert_eq!(
Expand Down Expand Up @@ -441,12 +438,7 @@ fn should_be_not_valid_yet() {
let (_, _, session_principal, session_salt, timestamp, claims) = valid_verification_test_data();

assert_eq!(
verify_claims(
&claims,
&session_principal,
&session_salt,
timestamp - 1
),
verify_claims(&claims, &session_principal, &session_salt, timestamp - 1),
Err("JWT is not valid yet".into())
);
}

0 comments on commit 90687f3

Please sign in to comment.