Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Dec 13, 2024
1 parent f4727d8 commit ef555b7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
18 changes: 13 additions & 5 deletions lib/komainu/src/authorize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@ use crate::{
error::{Error, Result},
flow::{PkceMethod, PkcePayload},
params::ParamStorage,
Authorization, Client, ClientExtractor, OAuthError, OptionExt, PreAuthorization,
Client, ClientExtractor, OAuthError, OptionExt, PreAuthorization,
};
use std::{
borrow::{Borrow, Cow},
collections::HashSet,
future::Future,
str::FromStr,
};
use std::{borrow::{Cow, Borrow}, collections::HashSet, future::Future, str::FromStr};

pub trait Issuer {
type UserId;

fn issue_code(
&self,
user_id: Self::UserId,
pre_authorization: PreAuthorization<'_>,
pre_authorization: PreAuthorization<'_, '_>,
) -> impl Future<Output = Result<String>> + Send;
}

Expand Down Expand Up @@ -74,7 +79,10 @@ where
PkceMethod::default()
};

Some(PkcePayload { method, challenge: Cow::Borrowed(challenge) })
Some(PkcePayload {
method,
challenge: Cow::Borrowed(challenge),
})
} else {
None
};
Expand Down Expand Up @@ -125,7 +133,7 @@ where

#[inline]
#[instrument(skip_all)]

Check warning on line 135 in lib/komainu/src/authorize.rs

View check run for this annotation

Codecov / codecov/patch

lib/komainu/src/authorize.rs#L135

Added line #L135 was not covered by tests
pub async fn accept<'a>(self, user_id: I::UserId, scopes: &'a [&'a str]) -> http::Response<()> {
pub async fn accept(self, user_id: I::UserId, scopes: &[&str]) -> http::Response<()> {
let pre_authorization = PreAuthorization {
client: &self.client,
scopes,
Expand Down
4 changes: 2 additions & 2 deletions lib/komainu/src/flow/authorization.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::{PkcePayload, TokenResponse};
use super::TokenResponse;
use crate::{
error::Result, params::ParamStorage, Authorization, Client, ClientExtractor, Error, OptionExt,
error::Result, params::ParamStorage, Authorization, ClientExtractor, Error, OptionExt,
};
use bytes::Bytes;
use headers::HeaderMapExt;
Expand Down
8 changes: 4 additions & 4 deletions lib/komainu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ pub struct Authorization<'a> {
pub scopes: Cow<'a, [Cow<'a, str>]>,
}

pub struct PreAuthorization<'a> {
pub client: &'a Client<'a>,
pub pkce_payload: Option<&'a PkcePayload<'a>>,
pub scopes: &'a [&'a str],
pub struct PreAuthorization<'a, 'b> {
pub client: &'b Client<'a>,
pub pkce_payload: Option<&'b PkcePayload<'a>>,
pub scopes: &'b [&'b str],
}

#[derive(Clone)]
Expand Down
4 changes: 0 additions & 4 deletions rust-toolchain.toml

This file was deleted.

0 comments on commit ef555b7

Please sign in to comment.