pub struct OAuth2Server { /* private fields */ }
Expand description
OAuth 2.0 Authorization Server
Implementations§
Source§impl OAuth2Server
impl OAuth2Server
pub async fn new( config: OAuth2Config, token_manager: Arc<TokenManager>, ) -> Result<Self>
Sourcepub async fn register_confidential_client(
&self,
client_id: String,
client_secret: &str,
redirect_uris: Vec<String>,
allowed_scopes: Vec<String>,
grant_types: Vec<String>,
) -> Result<()>
pub async fn register_confidential_client( &self, client_id: String, client_secret: &str, redirect_uris: Vec<String>, allowed_scopes: Vec<String>, grant_types: Vec<String>, ) -> Result<()>
Register a confidential client with proper secret validation
Sourcepub async fn register_public_client(
&self,
client_id: String,
redirect_uris: Vec<String>,
allowed_scopes: Vec<String>,
grant_types: Vec<String>,
) -> Result<()>
pub async fn register_public_client( &self, client_id: String, redirect_uris: Vec<String>, allowed_scopes: Vec<String>, grant_types: Vec<String>, ) -> Result<()>
Register a public client (PKCE required)
Create authorization code with proper user context
Sourcepub async fn token_exchange(
&self,
request: TokenRequest,
) -> Result<TokenResponse>
pub async fn token_exchange( &self, request: TokenRequest, ) -> Result<TokenResponse>
Handle token exchange with comprehensive validation
Sourcepub async fn revoke_token(&self, token: &str, client_id: &str) -> Result<bool>
pub async fn revoke_token(&self, token: &str, client_id: &str) -> Result<bool>
Revoke token (refresh token or access token)
Sourcepub async fn cleanup_expired_tokens(&self) -> Result<usize>
pub async fn cleanup_expired_tokens(&self) -> Result<usize>
Clean up expired tokens
Sourcepub async fn authenticate_user(
&self,
username: &str,
password: &str,
scopes: Vec<String>,
) -> Result<UserContext>
pub async fn authenticate_user( &self, username: &str, password: &str, scopes: Vec<String>, ) -> Result<UserContext>
Authenticate user and create session
Sourcepub async fn get_user_context(
&self,
session_id: &str,
) -> Result<Option<UserContext>>
pub async fn get_user_context( &self, session_id: &str, ) -> Result<Option<UserContext>>
Get user context from session
Sourcepub async fn invalidate_session(&self, session_id: &str) -> Result<bool>
pub async fn invalidate_session(&self, session_id: &str) -> Result<bool>
Invalidate user session
Auto Trait Implementations§
impl Freeze for OAuth2Server
impl !RefUnwindSafe for OAuth2Server
impl Send for OAuth2Server
impl Sync for OAuth2Server
impl Unpin for OAuth2Server
impl !UnwindSafe for OAuth2Server
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more