Skip to content

Commit

Permalink
chore: x509 identity extraction, replace filter + map by filter_map
Browse files Browse the repository at this point in the history
  • Loading branch information
beltram committed Aug 24, 2023
1 parent 46cc600 commit 2f1fb8a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions x509_credential/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ impl X509Ext for Certificate {
}
_ => None,
})
.filter(|n| n.starts_with(CLIENT_ID_PREFIX))
.map(|n| n.trim_start_matches(CLIENT_ID_PREFIX))
.filter_map(|n| {
n.starts_with(CLIENT_ID_PREFIX)
.then(|| n.trim_start_matches(CLIENT_ID_PREFIX))
})
.find_map(parse_client_id)
.map(|i| i.as_bytes().to_vec())
.ok_or(CryptoError::InvalidCertificate)
Expand Down

0 comments on commit 2f1fb8a

Please sign in to comment.