1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-07 17:03:01 +03:00

JWT response wrapper

Helps replying with a JWT to a request, with a
`Content-Type: application/jwt` header
This commit is contained in:
Quentin Gliech
2022-09-01 17:47:12 +02:00
parent 6818316a11
commit 1f0e273ac3
5 changed files with 45 additions and 7 deletions

View File

@@ -85,6 +85,12 @@ pub enum DecodeError {
TooManyDots,
}
impl<'a> From<RawJwt<'a>> for String {
fn from(val: RawJwt<'a>) -> Self {
val.inner.into()
}
}
impl<'a> TryFrom<&'a str> for RawJwt<'a> {
type Error = DecodeError;
fn try_from(value: &'a str) -> Result<Self, Self::Error> {

View File

@@ -256,6 +256,10 @@ impl<'a, T> Jwt<'a, T> {
pub fn as_str(&'a self) -> &'a str {
&self.raw
}
pub fn into_string(self) -> String {
self.raw.into()
}
}
#[derive(Debug, Error)]