Renamed methods to match spec
This commit is contained in:
parent
eaee14d174
commit
168bb56aa2
|
@ -57,7 +57,7 @@ fn handle_request(users: Arc<RwLock<HashMap<CertBytes, String>>>, request: Reque
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// The user didn't provide a certificate
|
// The user didn't provide a certificate
|
||||||
Response::needs_certificate()
|
Response::client_certificate_required()
|
||||||
}
|
}
|
||||||
}.boxed()
|
}.boxed()
|
||||||
}
|
}
|
||||||
|
|
12
src/types.rs
12
src/types.rs
|
@ -109,14 +109,14 @@ impl ResponseHeader {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn needs_certificate() -> Result<Self> {
|
pub fn client_certificate_required() -> Result<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
status: Status::CLIENT_CERTIFICATE_REQUIRED,
|
status: Status::CLIENT_CERTIFICATE_REQUIRED,
|
||||||
meta: Meta::new("No certificate provided")?,
|
meta: Meta::new("No certificate provided")?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn not_authorized() -> Result<Self> {
|
pub fn certificate_not_authorized() -> Result<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
status: Status::CERTIFICATE_NOT_AUTHORIZED,
|
status: Status::CERTIFICATE_NOT_AUTHORIZED,
|
||||||
meta: Meta::new("Your certificate is not authorized to view this content")?,
|
meta: Meta::new("Your certificate is not authorized to view this content")?,
|
||||||
|
@ -271,13 +271,13 @@ impl Response {
|
||||||
Ok(Self::new(header))
|
Ok(Self::new(header))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn needs_certificate() -> Result<Self> {
|
pub fn client_certificate_required() -> Result<Self> {
|
||||||
let header = ResponseHeader::needs_certificate()?;
|
let header = ResponseHeader::client_certificate_required()?;
|
||||||
Ok(Self::new(header))
|
Ok(Self::new(header))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn not_authorized() -> Result<Self> {
|
pub fn certificate_not_authorized() -> Result<Self> {
|
||||||
let header = ResponseHeader::not_authorized()?;
|
let header = ResponseHeader::certificate_not_authorized()?;
|
||||||
Ok(Self::new(header))
|
Ok(Self::new(header))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue