forked from didirus/AstralRinth
Labrinth ID cleanup (#3681)
* Put all ID types in the labrinth::models::ids, and reduce code duplication with them * Rewrite labrinth::database::models::ids and rename most DB interface ID structs to be prefixed with DB * Run sqlx prepare --------- Co-authored-by: Alejandro González <7822554+AlexTMjugador@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use super::errors::OAuthError;
|
||||
use crate::auth::oauth::OAuthErrorType;
|
||||
use crate::database::models::OAuthClientId;
|
||||
use crate::database::models::DBOAuthClientId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
@@ -16,7 +16,7 @@ impl ValidatedRedirectUri {
|
||||
pub fn validate<'a>(
|
||||
to_validate: &Option<String>,
|
||||
validate_against: impl IntoIterator<Item = &'a str> + Clone,
|
||||
client_id: OAuthClientId,
|
||||
client_id: DBOAuthClientId,
|
||||
) -> Result<Self, OAuthError> {
|
||||
if let Some(first_client_redirect_uri) =
|
||||
validate_against.clone().into_iter().next()
|
||||
@@ -61,7 +61,7 @@ mod tests {
|
||||
let validated = ValidatedRedirectUri::validate(
|
||||
&None,
|
||||
validate_against.clone(),
|
||||
OAuthClientId(0),
|
||||
DBOAuthClientId(0),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -82,7 +82,7 @@ mod tests {
|
||||
let validated = ValidatedRedirectUri::validate(
|
||||
&Some(to_validate.clone()),
|
||||
validate_against,
|
||||
OAuthClientId(0),
|
||||
DBOAuthClientId(0),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -97,7 +97,7 @@ mod tests {
|
||||
let validated = ValidatedRedirectUri::validate(
|
||||
&Some(to_validate),
|
||||
validate_against,
|
||||
OAuthClientId(0),
|
||||
DBOAuthClientId(0),
|
||||
);
|
||||
|
||||
assert!(validated.is_err_and(|e| matches!(
|
||||
|
||||
Reference in New Issue
Block a user