[−][src]Struct oxide_auth_rocket::Generic
A rather basic Endpoint
implementation.
Substitue all parts that are not provided with the marker struct Vacant
. This will at least
ensure that no security properties are violated. Some flows may be unavailable when some
primitives are missing. See AuthorizationFlow
, AccessTokenFlow
, ResourceFlow
for
more details.
Included types are assumed to be implemented independently, with no major connections. All attributes are public, so there is no inner invariant.
Usage
You should prefer this implementation when there are special requirements for your Endpoint
implementation, or it is created ad-hoc. It also does some static type checking on dedicated
methods to ensure that the creation of specific flows succeeds. You should prefer
authorization_flow
, access_token_flow
, and resource_flow
over the erroring preparation
methods in AuthorizationFlow
, AccessTokenFlow
, and ResourceFlow
respectively.
This should not be used when you special interacting primitives are used, that originate from
outside this library. For example if you intend for your Scopes
to be dynamically generated
from a list of registered clients, its likely cleaner to provide your own Endpoint
implementation instead.
Example
Here is an example where a Generic
is used to set up an endpoint that is filled with the
minimal members to be useable for an AccessTokenFlow
.
use oxide_auth::endpoint::{AccessTokenFlow, Endpoint, WebRequest}; use oxide_auth::primitives::{ authorizer::AuthMap, generator::RandomGenerator, issuer::TokenMap, registrar::ClientMap, }; fn access_token_endpoint<R: WebRequest>() -> AccessTokenFlow<impl Endpoint<R>, R> where R::Response: Default, { let endpoint = Generic { authorizer: AuthMap::new(RandomGenerator::new(16)), registrar: ClientMap::new(), issuer: TokenMap::new(RandomGenerator::new(16)), scopes: Vacant, solicitor: Vacant, response: Vacant, }; endpoint.access_token_flow() }
Fields
registrar: R
The registrar implementation, or Vacant
if it is not necesary.
The authorizer implementation, or Vacant
if it is not necesary.
issuer: I
The issuer implementation, or Vacant
if it is not necesary.
solicitor: S
A solicitor implementation fit for the request types, or Vacant
if it is not necesary.
scopes: C
Determine scopes for the request types, or Vacant
if this does not protect resources.
response: L
Creates responses, or Vacant
if Default::default
is applicable.
Implementations
impl<R, A, I, O, C, L> Generic<R, A, I, O, C, L>
[src]
pub fn with_solicitor<N>(self, new_solicitor: N) -> Generic<R, A, I, N, C, L>
[src]
Change the used solicitor.
pub fn with_scopes<S>(self, new_scopes: S) -> Generic<R, A, I, O, S, L>
[src]
Change the used scopes.
pub fn authorization_flow<W>(
self
) -> AuthorizationFlow<Generic<R, A, I, O, C, L>, W> where
A: Authorizer,
R: Registrar,
W: WebRequest,
Generic<R, A, I, O, C, L>: Endpoint<W>,
[src]
self
) -> AuthorizationFlow<Generic<R, A, I, O, C, L>, W> where
A: Authorizer,
R: Registrar,
W: WebRequest,
Generic<R, A, I, O, C, L>: Endpoint<W>,
Create an authorization flow.
Opposed to AuthorizationFlow::prepare
this statically ensures that the construction
succeeds.
pub fn access_token_flow<W>(
self
) -> AccessTokenFlow<Generic<R, A, I, O, C, L>, W> where
A: Authorizer,
I: Issuer,
R: Registrar,
W: WebRequest,
Generic<R, A, I, O, C, L>: Endpoint<W>,
[src]
self
) -> AccessTokenFlow<Generic<R, A, I, O, C, L>, W> where
A: Authorizer,
I: Issuer,
R: Registrar,
W: WebRequest,
Generic<R, A, I, O, C, L>: Endpoint<W>,
Create an access token flow.
Opposed to AccessTokenFlow::prepare
this statically ensures that the construction
succeeds.
pub fn refresh_flow<W>(self) -> RefreshFlow<Generic<R, A, I, O, C, L>, W> where
I: Issuer,
R: Registrar,
W: WebRequest,
Generic<R, A, I, O, C, L>: Endpoint<W>,
[src]
I: Issuer,
R: Registrar,
W: WebRequest,
Generic<R, A, I, O, C, L>: Endpoint<W>,
Create a token refresh flow.
Opposed to RefreshFlow::prepare
this statically ensures that the construction succeeds.
pub fn resource_flow<W>(self) -> ResourceFlow<Generic<R, A, I, O, C, L>, W> where
I: Issuer,
W: WebRequest,
Generic<R, A, I, O, C, L>: Endpoint<W>,
[src]
I: Issuer,
W: WebRequest,
Generic<R, A, I, O, C, L>: Endpoint<W>,
Create a resource access flow.
Opposed to ResourceFlow::prepare
this statically ensures that the construction succeeds.
pub fn assert<W>(self) -> Generic<R, A, I, O, C, L> where
W: WebRequest,
Generic<R, A, I, O, C, L>: Endpoint<W>,
[src]
W: WebRequest,
Generic<R, A, I, O, C, L>: Endpoint<W>,
Check, statically, that this is an endpoint for some request.
This is mainly a utility method intended for compilation and integration tests.
Trait Implementations
impl<W, R, A, I, O, C, L> Endpoint<W> for Generic<R, A, I, O, C, L> where
A: OptAuthorizer,
C: Scopes<W>,
I: OptIssuer,
L: ResponseCreator<W>,
O: OwnerSolicitor<W>,
R: OptRegistrar,
W: WebRequest,
[src]
A: OptAuthorizer,
C: Scopes<W>,
I: OptIssuer,
L: ResponseCreator<W>,
O: OwnerSolicitor<W>,
R: OptRegistrar,
W: WebRequest,
type Error = Error<W>
The error typed used as the error representation of each flow.
fn registrar(&self) -> Option<&dyn Registrar>
[src]
fn authorizer_mut(&mut self) -> Option<&mut dyn Authorizer>
[src]
fn issuer_mut(&mut self) -> Option<&mut dyn Issuer>
[src]
fn owner_solicitor(&mut self) -> Option<&mut dyn OwnerSolicitor<W>>
[src]
fn scopes(&mut self) -> Option<&mut dyn Scopes<W>>
[src]
fn response(
&mut self,
request: &mut W,
kind: Template<'_>
) -> Result<<W as WebRequest>::Response, <Generic<R, A, I, O, C, L> as Endpoint<W>>::Error>
[src]
&mut self,
request: &mut W,
kind: Template<'_>
) -> Result<<W as WebRequest>::Response, <Generic<R, A, I, O, C, L> as Endpoint<W>>::Error>
fn error(&mut self, err: OAuthError) -> Error<W>
[src]
fn web_error(&mut self, err: <W as WebRequest>::Error) -> Error<W>
[src]
fn extension(&mut self) -> Option<&mut dyn Extension>
[src]
Auto Trait Implementations
impl<R, A, I, S, C, L> RefUnwindSafe for Generic<R, A, I, S, C, L> where
A: RefUnwindSafe,
C: RefUnwindSafe,
I: RefUnwindSafe,
L: RefUnwindSafe,
R: RefUnwindSafe,
S: RefUnwindSafe,
A: RefUnwindSafe,
C: RefUnwindSafe,
I: RefUnwindSafe,
L: RefUnwindSafe,
R: RefUnwindSafe,
S: RefUnwindSafe,
impl<R, A, I, S, C, L> Send for Generic<R, A, I, S, C, L> where
A: Send,
C: Send,
I: Send,
L: Send,
R: Send,
S: Send,
A: Send,
C: Send,
I: Send,
L: Send,
R: Send,
S: Send,
impl<R, A, I, S, C, L> Sync for Generic<R, A, I, S, C, L> where
A: Sync,
C: Sync,
I: Sync,
L: Sync,
R: Sync,
S: Sync,
A: Sync,
C: Sync,
I: Sync,
L: Sync,
R: Sync,
S: Sync,
impl<R, A, I, S, C, L> Unpin for Generic<R, A, I, S, C, L> where
A: Unpin,
C: Unpin,
I: Unpin,
L: Unpin,
R: Unpin,
S: Unpin,
A: Unpin,
C: Unpin,
I: Unpin,
L: Unpin,
R: Unpin,
S: Unpin,
impl<R, A, I, S, C, L> UnwindSafe for Generic<R, A, I, S, C, L> where
A: UnwindSafe,
C: UnwindSafe,
I: UnwindSafe,
L: UnwindSafe,
R: UnwindSafe,
S: UnwindSafe,
A: UnwindSafe,
C: UnwindSafe,
I: UnwindSafe,
L: UnwindSafe,
R: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T, I> AsResult<T, I> for T where
I: Input,
I: Input,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoCollection<T> for T
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
A: Array<Item = T>,
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
A: Array<Item = U>,
F: FnMut(T) -> U,
A: Array<Item = U>,
F: FnMut(T) -> U,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,