You've already forked authentication-service
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:
@@ -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> {
|
||||
|
@@ -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)]
|
||||
|
Reference in New Issue
Block a user