mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
update certificate match function
This commit is contained in:
parent
7ff9efb166
commit
e60a00c500
2 changed files with 24 additions and 12 deletions
|
|
@ -37,14 +37,14 @@ impl Identity {
|
|||
}
|
||||
}
|
||||
|
||||
/// Get `pem` record match `request` according to
|
||||
/// [Gemini protocol specification](https://geminiprotocol.net/docs/protocol-specification.gmi#client-certificates)
|
||||
/// * this function work with memory cache not database
|
||||
/// Get `pem` record match `request`
|
||||
/// * [Client certificates specification](https://geminiprotocol.net/docs/protocol-specification.gmi#client-certificates)
|
||||
/// * this function work with memory cache collected (not database)
|
||||
pub fn gemini(&self, request: &str) -> Option<String> {
|
||||
// @TODO apply protocol rules to certificate selection
|
||||
for profile_identity_gemini_id in self.gemini.auth.memory.starts_with(request) {
|
||||
if let Ok(pem) = self.gemini.memory.get(profile_identity_gemini_id) {
|
||||
return Some(pem);
|
||||
if let Some(id) = self.gemini.auth.memory.match_priority(request) {
|
||||
match self.gemini.memory.get(id) {
|
||||
Ok(pem) => return Some(pem),
|
||||
Err(_) => todo!(),
|
||||
}
|
||||
}
|
||||
None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue