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
Use iana generated types in more places
This commit is contained in:
@ -13,4 +13,5 @@ url = { version = "2.2.2", features = ["serde"] }
|
||||
crc = "2.1.0"
|
||||
rand = "0.8.4"
|
||||
|
||||
mas-iana = { path = "../iana" }
|
||||
oauth2-types = { path = "../oauth2-types" }
|
||||
|
@ -15,7 +15,8 @@
|
||||
use std::num::NonZeroU32;
|
||||
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
use oauth2_types::{pkce::CodeChallengeMethod, requests::ResponseMode};
|
||||
use mas_iana::oauth::PkceCodeChallengeMethod;
|
||||
use oauth2_types::{pkce::CodeChallengeMethodExt, requests::ResponseMode};
|
||||
use serde::Serialize;
|
||||
use thiserror::Error;
|
||||
use url::Url;
|
||||
@ -25,13 +26,13 @@ use crate::{traits::StorageBackend, StorageBackendMarker};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
pub struct Pkce {
|
||||
pub challenge_method: CodeChallengeMethod,
|
||||
pub challenge_method: PkceCodeChallengeMethod,
|
||||
pub challenge: String,
|
||||
}
|
||||
|
||||
impl Pkce {
|
||||
#[must_use]
|
||||
pub fn new(challenge_method: CodeChallengeMethod, challenge: String) -> Self {
|
||||
pub fn new(challenge_method: PkceCodeChallengeMethod, challenge: String) -> Self {
|
||||
Pkce {
|
||||
challenge_method,
|
||||
challenge,
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
use chrono::{DateTime, Duration, Utc};
|
||||
use crc::{Crc, CRC_32_ISO_HDLC};
|
||||
use oauth2_types::requests::TokenTypeHint;
|
||||
use mas_iana::oauth::OAuthTokenTypeHint;
|
||||
use rand::{distributions::Alphanumeric, Rng};
|
||||
use thiserror::Error;
|
||||
|
||||
@ -159,12 +159,12 @@ impl TokenType {
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq<TokenTypeHint> for TokenType {
|
||||
fn eq(&self, other: &TokenTypeHint) -> bool {
|
||||
impl PartialEq<OAuthTokenTypeHint> for TokenType {
|
||||
fn eq(&self, other: &OAuthTokenTypeHint) -> bool {
|
||||
matches!(
|
||||
(self, other),
|
||||
(TokenType::AccessToken, TokenTypeHint::AccessToken)
|
||||
| (TokenType::RefreshToken, TokenTypeHint::RefreshToken)
|
||||
(TokenType::AccessToken, OAuthTokenTypeHint::AccessToken)
|
||||
| (TokenType::RefreshToken, OAuthTokenTypeHint::RefreshToken)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user