You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-29 22:01:14 +03:00
Implement Clone on ClientCredentials
This commit is contained in:
committed by
Quentin Gliech
parent
ecf101fe2d
commit
d0c5eb3741
@ -52,17 +52,17 @@ pub const CLIENT_SUPPORTED_AUTH_METHODS: &[OAuthClientAuthenticationMethod] = &[
|
||||
|
||||
/// A function that takes a map of claims and a signing algorithm and returns a
|
||||
/// signed JWT.
|
||||
pub type JwtSigningFn =
|
||||
dyn Fn(HashMap<String, Value>, JsonWebSignatureAlg) -> Result<String, BoxError> + Send + Sync;
|
||||
pub type JwtSigningFn = fn(HashMap<String, Value>, JsonWebSignatureAlg) -> Result<String, BoxError>;
|
||||
|
||||
/// The method used to sign JWTs with a private key.
|
||||
#[derive(Clone)]
|
||||
pub enum JwtSigningMethod {
|
||||
/// Sign the JWTs with this library, by providing the signing keys.
|
||||
#[cfg(feature = "keystore")]
|
||||
Keystore(Keystore),
|
||||
|
||||
/// Sign the JWTs in a callback.
|
||||
Custom(Box<JwtSigningFn>),
|
||||
Custom(JwtSigningFn),
|
||||
}
|
||||
|
||||
impl JwtSigningMethod {
|
||||
@ -75,14 +75,8 @@ impl JwtSigningMethod {
|
||||
|
||||
/// Creates a new [`JwtSigningMethod`] from a [`JwtSigningFn`].
|
||||
#[must_use]
|
||||
pub fn with_custom_signing_method<F>(signing_fn: F) -> Self
|
||||
where
|
||||
F: Fn(HashMap<String, Value>, JsonWebSignatureAlg) -> Result<String, BoxError>
|
||||
+ Send
|
||||
+ Sync
|
||||
+ 'static,
|
||||
{
|
||||
Self::Custom(Box::new(signing_fn))
|
||||
pub fn with_custom_signing_method(signing_fn: JwtSigningFn) -> Self {
|
||||
Self::Custom(signing_fn)
|
||||
}
|
||||
|
||||
/// Get the [`Keystore`] from this [`JwtSigningMethod`].
|
||||
@ -107,6 +101,7 @@ impl JwtSigningMethod {
|
||||
|
||||
/// The credentials obtained during registration, to authenticate a client on
|
||||
/// endpoints that require it.
|
||||
#[derive(Clone)]
|
||||
pub enum ClientCredentials {
|
||||
/// No client authentication is used.
|
||||
///
|
||||
|
Reference in New Issue
Block a user