Skip to content

Commit 715cf95

Browse files
authored
feat: add hashed_fxa_uid to HawkPayload (#1613)
add hashed_fxa_uid to HawkPayload, HawkIdentifier, UserIdentifier
1 parent 7f2ef06 commit 715cf95

File tree

5 files changed

+12
-0
lines changed

5 files changed

+12
-0
lines changed

syncserver/src/server/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ fn create_hawk_header(method: &str, port: u16, path: &str) -> String {
174174
user_id: 42,
175175
fxa_uid: format!("xxx_test_uid_{}", *RAND_UID),
176176
fxa_kid: format!("xxx_test_kid_{}", *RAND_UID),
177+
hashed_fxa_uid: format!("xxx_test_hashed_fxa_uid_{}", *RAND_UID),
177178
hashed_device_id: "xxx_test".to_owned(),
178179
tokenserver_origin: Default::default(),
179180
};

syncserver/src/web/auth.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ pub struct HawkPayload {
5353
#[serde(default)]
5454
pub fxa_kid: String,
5555

56+
#[serde(default)]
57+
pub hashed_fxa_uid: String,
58+
5659
#[serde(default)]
5760
pub hashed_device_id: String,
5861

@@ -156,6 +159,7 @@ impl HawkPayload {
156159
user_id,
157160
fxa_uid: "xxx_test".to_owned(),
158161
fxa_kid: "xxx_test".to_owned(),
162+
hashed_fxa_uid: "xxx_test".to_owned(),
159163
hashed_device_id: "xxx_test".to_owned(),
160164
tokenserver_origin: Default::default(),
161165
}
@@ -508,6 +512,7 @@ mod tests {
508512
user_id: 1,
509513
fxa_uid: "319b98f9961ff1dbdd07313cd6ba925a".to_owned(),
510514
fxa_kid: "de697ad66d845b2873c9d7e13b8971af".to_owned(),
515+
hashed_fxa_uid: "0e8df5d41398a389913bd8402435649518af46493da1d4a437a46dc1784c501a".to_owned(),
511516
hashed_device_id: "2bcb92f4d4698c3d7b083a3c698a16ccd78bc2a8d20a96e4bb128ddceaf4e0b6".to_owned(),
512517
tokenserver_origin: Default::default(),
513518
},

syncserver/src/web/extractors.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,7 @@ pub struct HawkIdentifier {
994994
/// For NoSQL database backends that require randomly distributed primary keys
995995
pub fxa_uid: String,
996996
pub fxa_kid: String,
997+
pub hashed_fxa_uid: String,
997998
pub tokenserver_origin: TokenserverOrigin,
998999
}
9991000

@@ -1004,6 +1005,7 @@ impl HawkIdentifier {
10041005
legacy_id: 0,
10051006
fxa_uid: "cmd".to_owned(),
10061007
fxa_kid: "cmd".to_owned(),
1008+
hashed_fxa_uid: "cmd".to_owned(),
10071009
tokenserver_origin: TokenserverOrigin::default(),
10081010
}
10091011
}
@@ -1106,6 +1108,7 @@ impl HawkIdentifier {
11061108
legacy_id: payload.user_id,
11071109
fxa_uid: payload.fxa_uid,
11081110
fxa_kid: payload.fxa_kid,
1111+
hashed_fxa_uid: payload.hashed_fxa_uid,
11091112
tokenserver_origin: payload.tokenserver_origin,
11101113
};
11111114
Ok(user_id)
@@ -1118,6 +1121,7 @@ impl From<HawkIdentifier> for UserIdentifier {
11181121
legacy_id: hawk_id.legacy_id,
11191122
fxa_uid: hawk_id.fxa_uid,
11201123
fxa_kid: hawk_id.fxa_kid,
1124+
hashed_fxa_uid: hawk_id.hashed_fxa_uid,
11211125
}
11221126
}
11231127
}

syncstorage-db-common/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,4 +277,5 @@ pub struct UserIdentifier {
277277
/// For NoSQL database backends that require randomly distributed primary keys
278278
pub fxa_uid: String,
279279
pub fxa_kid: String,
280+
pub hashed_fxa_uid: String,
280281
}

syncstorage-db/src/tests/support.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,6 @@ pub fn hid(user_id: u32) -> UserIdentifier {
130130
legacy_id: u64::from(user_id),
131131
fxa_uid: format!("xxx_unit_tests_fxa_uid{}", user_id),
132132
fxa_kid: format!("xxx_unit_tests_fxa_kid{}", user_id),
133+
hashed_fxa_uid: format!("xxx_unit_tests_hashed_fxa_uid{}", user_id),
133134
}
134135
}

0 commit comments

Comments
 (0)