Skip to content

Commit

Permalink
Support standard OIDC birthdate claim (#120)
Browse files Browse the repository at this point in the history
Fixes #119
  • Loading branch information
alex-swift authored Jul 11, 2023
1 parent 1bc4a2f commit 414eb35
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ where
pub(crate) email_verified: Option<bool>,
pub(crate) gender: Option<GC>,
pub(crate) birthday: Option<EndUserBirthday>,
pub(crate) birthdate: Option<EndUserBirthday>,
pub(crate) zoneinfo: Option<EndUserTimezone>,
pub(crate) locale: Option<LanguageTag>,
pub(crate) phone_number: Option<EndUserPhoneNumber>,
Expand Down Expand Up @@ -137,6 +138,7 @@ where
email_verified: None,
gender: None,
birthday: None,
birthdate: None,
zoneinfo: None,
locale: None,
phone_number: None,
Expand Down Expand Up @@ -178,6 +180,7 @@ where
set_email_verified -> email_verified[Option<bool>],
set_gender -> gender[Option<GC>],
set_birthday -> birthday[Option<EndUserBirthday>],
set_birthdate -> birthdate[Option<EndUserBirthday>],
set_zoneinfo -> zoneinfo[Option<EndUserTimezone>],
set_locale -> locale[Option<LanguageTag>],
set_phone_number -> phone_number[Option<EndUserPhoneNumber>],
Expand Down Expand Up @@ -210,6 +213,7 @@ where
| ("email_verified", None)
| ("gender", None)
| ("birthday", None)
| ("birthdate", None)
| ("zoneinfo", None)
| ("locale", None)
| ("phone_number", None)
Expand Down Expand Up @@ -261,6 +265,7 @@ where
[Option(Boolean(email_verified))]
[Option(gender)]
[Option(birthday)]
[Option(birthdate)]
[Option(zoneinfo)]
[Option(locale)]
[Option(phone_number)]
Expand Down Expand Up @@ -299,6 +304,7 @@ where
[Option(email_verified)]
[Option(gender)]
[Option(birthday)]
[Option(birthdate)]
[Option(zoneinfo)]
[Option(locale)]
[Option(phone_number)]
Expand Down
5 changes: 5 additions & 0 deletions src/id_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ where
set_email_verified -> email_verified[Option<bool>],
set_gender -> gender[Option<GC>],
set_birthday -> birthday[Option<EndUserBirthday>],
set_birthdate -> birthdate[Option<EndUserBirthday>],
set_zoneinfo -> zoneinfo[Option<EndUserTimezone>],
set_locale -> locale[Option<LanguageTag>],
set_phone_number -> phone_number[Option<EndUserPhoneNumber>],
Expand Down Expand Up @@ -621,6 +622,7 @@ mod tests {
assert_eq!(claims.email_verified(), None);
assert_eq!(claims.gender(), None);
assert_eq!(claims.birthday(), None);
assert_eq!(claims.birthdate(), None);
assert_eq!(claims.zoneinfo(), None);
assert_eq!(claims.locale(), None);
assert_eq!(claims.phone_number(), None);
Expand Down Expand Up @@ -672,6 +674,7 @@ mod tests {
\"email_verified\":true,\
\"gender\":\"male\",\
\"birthday\":\"1956-05-12\",\
\"birthdate\":\"1956-07-12\",\
\"zoneinfo\":\"America/Los_Angeles\",\
\"locale\":\"en-US\",\
\"phone_number\":\"+1 (555) 555-5555\",\
Expand Down Expand Up @@ -808,6 +811,7 @@ mod tests {
email_verified: Some(true),
gender: Some(CoreGenderClaim::new("male".to_string())),
birthday: Some(EndUserBirthday::new("1956-05-12".to_string())),
birthdate: Some(EndUserBirthday::new("1956-07-12".to_string())),
zoneinfo: Some(EndUserTimezone::new("America/Los_Angeles".to_string())),
locale: Some(LanguageTag::new("en-US".to_string())),
phone_number: Some(EndUserPhoneNumber::new("+1 (555) 555-5555".to_string())),
Expand Down Expand Up @@ -885,6 +889,7 @@ mod tests {
assert_eq!(claims.email_verified(), new_claims.email_verified());
assert_eq!(claims.gender(), new_claims.gender());
assert_eq!(claims.birthday(), new_claims.birthday());
assert_eq!(claims.birthdate(), new_claims.birthdate());
assert_eq!(claims.zoneinfo(), new_claims.zoneinfo());
assert_eq!(claims.locale(), new_claims.locale());
assert_eq!(claims.phone_number(), new_claims.phone_number(),);
Expand Down
1 change: 1 addition & 0 deletions src/user_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ where
set_email_verified -> email_verified[Option<bool>],
set_gender -> gender[Option<GC>],
set_birthday -> birthday[Option<EndUserBirthday>],
set_birthdate -> birthdate[Option<EndUserBirthday>],
set_zoneinfo -> zoneinfo[Option<EndUserTimezone>],
set_locale -> locale[Option<LanguageTag>],
set_phone_number -> phone_number[Option<EndUserPhoneNumber>],
Expand Down
1 change: 1 addition & 0 deletions src/verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2081,6 +2081,7 @@ mod tests {
email_verified: None,
gender: None,
birthday: None,
birthdate: None,
zoneinfo: None,
locale: None,
phone_number: None,
Expand Down

0 comments on commit 414eb35

Please sign in to comment.