pub struct App {
pub base: AppBase<ServerImpl<Details>>,
pub attribute_types: Map<Type>,
pub yivi: Option<YiviCtx>,
pub auth_state_secret: SealingKey,
pub auth_window: Duration,
pub attr_key_secret: Vec<u8>,
pub chained_sessions_ctl: Option<ChainedSessionsCtl>,
}Expand description
Authentication server per-thread App that handles incoming requests.
Fields§
§base: AppBase<ServerImpl<Details>>§attribute_types: Map<Type>§yivi: Option<YiviCtx>§auth_state_secret: SealingKey§auth_window: Duration§attr_key_secret: Vec<u8>§chained_sessions_ctl: Option<ChainedSessionsCtl>Implementations§
Source§impl App
§Implementaton of endpoints
impl App
§Implementaton of endpoints
Sourcepub async fn handle_auth_start(
app: Rc<Self>,
req: Json<AuthStartReq>,
) -> Result<AuthStartResp>
pub async fn handle_auth_start( app: Rc<Self>, req: Json<AuthStartReq>, ) -> Result<AuthStartResp>
Implements api::auths::AuthStartEP
Sourcefn create_disclosure_con_for(
&self,
attr_type_id: &AttributeTypeIdentifier,
) -> Result<Vec<AttributeRequest>>
fn create_disclosure_con_for( &self, attr_type_id: &AttributeTypeIdentifier, ) -> Result<Vec<AttributeRequest>>
Creates a disclosure ‘conjunction’ for the given yivi attribute type identifier.
This is almost always just the attibute type idenfitier itself, unless we’re dealing with the pubhubs card - in which case two other factors are added that fixes the registration source, and allows the user to see the ‘comment’ attached to the card (usually the redacted email address and phone number.)
The yivi attribute type that will provide the actual value for the pubhubs attribute
will always come first. This is important because
yivi::SessionResult::validate_and_extract_raw_singles will only pick the first value
from each inner conjunction.
async fn handle_auth_start_yivi( app: Rc<Self>, state: AuthState, yivi_chained_session: bool, yivi_chained_session_drip: bool, ) -> Result<AuthStartResp>
pub async fn handle_auth_complete( app: Rc<Self>, req: Json<AuthCompleteReq>, ) -> Result<AuthCompleteResp>
async fn handle_auth_complete_yivi( app: Rc<Self>, state: AuthState, disclosure: JWT, ) -> Result<AuthCompleteResp>
Source§impl App
impl App
Sourcepub(crate) fn registration_source<'a>(&'a self, yivi: &'a YiviCtx) -> &'a str
pub(crate) fn registration_source<'a>(&'a self, yivi: &'a YiviCtx) -> &'a str
Gets the registration source to use when issuing a pubhubs card
Sourcepub(crate) fn issue_card(
&self,
card_pseud_package: CardPseudPackage,
comment: Option<String>,
) -> Result<(ExtendedSessionRequest, Attr)>
pub(crate) fn issue_card( &self, card_pseud_package: CardPseudPackage, comment: Option<String>, ) -> Result<(ExtendedSessionRequest, Attr)>
Creates a yivi issuance request and pubhubs attribute for a PubHubs card
Sourcepub async fn handle_card(app: Rc<Self>, req: Json<CardReq>) -> Result<CardResp>
pub async fn handle_card(app: Rc<Self>, req: Json<CardReq>) -> Result<CardResp>
Implements api::auths::CardEP.
Source§impl App
impl App
Sourcepub async fn handle_attr_keys(
app: Rc<Self>,
reqs: Json<HashMap<Handle, AttrKeyReq>>,
) -> Result<AttrKeysResp>
pub async fn handle_attr_keys( app: Rc<Self>, reqs: Json<HashMap<Handle, AttrKeyReq>>, ) -> Result<AttrKeysResp>
Implements api::auths::AttrKeysEP.
Source§impl App
§Helper functions
impl App
§Helper functions
pub fn get_yivi(&self) -> Result<&YiviCtx, ErrorCode>
Sourcepub fn attr_type_from_handle<'s>(
&'s self,
attr_type_handle: &Handle,
) -> Option<&'s Type>
pub fn attr_type_from_handle<'s>( &'s self, attr_type_handle: &Handle, ) -> Option<&'s Type>
Get attr::Type by handle::Handle, returning None
when it cannot be found.
Source§impl App
impl App
Sourceasync fn handle_hub_ping(
app: Rc<Self>,
signed_req: Json<TicketSigned<PingReq>>,
) -> Result<PingResp>
async fn handle_hub_ping( app: Rc<Self>, signed_req: Json<TicketSigned<PingReq>>, ) -> Result<PingResp>
Implements api::server::HubPingEP.
Sourcefn cached_handle_welcome(app: &Self) -> Result<WelcomeResp>
fn cached_handle_welcome(app: &Self) -> Result<WelcomeResp>
Implements api::auths::WelcomeEP.
Source§impl App
impl App
pub fn chained_sessions_ctl_or_bad_request(&self) -> Result<&ChainedSessionsCtl>
Sourcepub async fn handle_yivi_wait_for_result(
app: Rc<Self>,
req: Json<YiviWaitForResultReq>,
) -> Result<YiviWaitForResultResp>
pub async fn handle_yivi_wait_for_result( app: Rc<Self>, req: Json<YiviWaitForResultReq>, ) -> Result<YiviWaitForResultResp>
Implements the api::auths::YiviWaitForResultEP endpoint.
Sourcepub async fn handle_yivi_next_session(
app: Data<Rc<App>>,
query: Query<YiviNextSessionQuery>,
result_jwt: String,
) -> impl Responder
pub async fn handle_yivi_next_session( app: Data<Rc<App>>, query: Query<YiviNextSessionQuery>, result_jwt: String, ) -> impl Responder
Implements the api::auths::YIVI_NEXT_SESSION_PATH endpoint.
async fn regular_wfns_responder( wfns_fut: impl Future<Output = Result<Option<ExtendedSessionRequest>>>, ) -> impl Responder
fn dripping_wfns_responder( wfns_fut: impl Future<Output = Result<Option<ExtendedSessionRequest>>> + 'static, ) -> impl Responder
Sourcepub async fn handle_yivi_release_next_session(
app: Rc<Self>,
req: Json<YiviReleaseNextSessionReq>,
) -> Result<YiviReleaseNextSessionResp>
pub async fn handle_yivi_release_next_session( app: Rc<Self>, req: Json<YiviReleaseNextSessionReq>, ) -> Result<YiviReleaseNextSessionResp>
Implements the api::auths::YiviReleaseNextSessionEP endpoint.
Methods from Deref<Target = AppBase<ServerImpl<Details>>>§
Sourcepub async fn get_object<T>(
&self,
id: &T::Identifier,
) -> Result<Option<(T, UpdateVersion)>>where
T: ObjectDetails,
pub async fn get_object<T>(
&self,
id: &T::Identifier,
) -> Result<Option<(T, UpdateVersion)>>where
T: ObjectDetails,
Tries to retrieve an object of type T from this server’s object store with the given
id, returning Ok(None) if no such object exists.
Sourcepub async fn put_object<T>(
&self,
obj: &T,
update: Option<UpdateVersion>,
) -> Result<Option<UpdateVersion>>where
T: ObjectDetails,
pub async fn put_object<T>(
&self,
obj: &T,
update: Option<UpdateVersion>,
) -> Result<Option<UpdateVersion>>where
T: ObjectDetails,
Attempts to put an object of type T into the object store, only overwriting the object that
is already present when the version of the to-be-overwritten object is passed via update.
Returs Ok(None) when there is already an object present in the store with that id and
type, but its version was not specified in update.
Sourcepub async fn delete_object<T>(&self, id: T::Identifier) -> Result<bool>where
T: ObjectDetails,
pub async fn delete_object<T>(&self, id: T::Identifier) -> Result<bool>where
T: ObjectDetails,
Attempts to delete an object with the given Id; returns true when an object was
deleted, and false when no object with the given id was found.
Sourcepub fn running_state_or_please_retry(
&self,
) -> Result<&RunningState<S::ExtraRunningState>, ErrorCode>
pub fn running_state_or_please_retry( &self, ) -> Result<&RunningState<S::ExtraRunningState>, ErrorCode>
Returns the current RunningState of this server when available.
Otherwise returns api::ErrorCode::PleaseRetry.
Sourcepub fn running_state_or_internal_error(
&self,
) -> Result<&RunningState<S::ExtraRunningState>, ErrorCode>
pub fn running_state_or_internal_error( &self, ) -> Result<&RunningState<S::ExtraRunningState>, ErrorCode>
Returns the current RunningState of this server when available.
Otherwise returns api::ErrorCode::InternalError.
Trait Implementations§
Source§impl App<ServerImpl<Details>> for App
impl App<ServerImpl<Details>> for App
Source§fn configure_actix_app(self: &Rc<Self>, sc: &mut ServiceConfig)
fn configure_actix_app(self: &Rc<Self>, sc: &mut ServiceConfig)
App to add server-specific endpoints. Non-server specific endpoints are added by
AppBase::configure_actix_app.Source§fn check_constellation(&self, constellation: &Constellation) -> bool
fn check_constellation(&self, constellation: &Constellation) -> bool
Source§async fn discover(
self: &Rc<Self>,
phc_inf: DiscoveryInfoResp,
) -> Result<DiscoverVerdict>
async fn discover( self: &Rc<Self>, phc_inf: DiscoveryInfoResp, ) -> Result<DiscoverVerdict>
api::DiscoveryInfoResp already
obtained from Pubhubs Central. If the server is not PHC itself, the Constellation
in this api::DiscoveryInfoResp must be set. Read moreSource§fn master_enc_key_part(&self) -> Option<&PrivateKey>
fn master_enc_key_part(&self) -> Option<&PrivateKey>
Source§async fn local_task(_weak: Weak<Self>)
async fn local_task(_weak: Weak<Self>)
App that is created.Source§async fn global_task(_app: Rc<Self>) -> Result<Infallible>
async fn global_task(_app: Rc<Self>) -> Result<Infallible>
Auto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl !Send for App
impl !Sync for App
impl Unpin for App
impl UnsafeUnpin for App
impl !UnwindSafe for App
Blanket Implementations§
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
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>
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>
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