async fn extract_user_id(req: &ServiceRequest) -> Result<Uuid, TelescopeError> {
    req
        // Get the identity of the service request -- this should be a json encoded authentication
        // cookie if it exists.
        .get_identity()
        // Deserialize the authentication cookie object if it exists.
        .and_then(|ident| serde_json::from_str::<AuthenticationCookie>(ident.as_str()).ok())
        // If not authenticated, return an error indicating so.
        .ok_or(TelescopeError::NotAuthenticated)?
        // Refresh the cookie if necessary.
        .refresh()
        .await?
        // Get the RCOS user ID associated with the authenticated user.
        .get_user_id()
        .await?
        // Respond with an error if the user is not found.
        .ok_or(TelescopeError::NotAuthenticated)
}
/// Extract the RCOS user ID authenticated with a request or error.
Extract the RCOS user ID authenticated with a request or error.
Extract the RCOS user ID authenticated with a request or error .
async fn extract_user_id(req: &ServiceRequest) -> Result<Uuid, TelescopeError> {
    req
        // Get the identity of the service request -- this should be a json encoded authentication
        // cookie if it exists.
        .get_identity()
        // Deserialize the authentication cookie object if it exists.
        .and_then(|ident| serde_json::from_str::<AuthenticationCookie>(ident.as_str()).ok())
        // If not authenticated, return an error indicating so.
        .ok_or(TelescopeError::NotAuthenticated)?
        // Refresh the cookie if necessary.
        .refresh()
        .await?
        // Get the RCOS user ID associated with the authenticated user.
        .get_user_id()
        .await?
        // Respond with an error if the user is not found.
        .ok_or(TelescopeError::NotAuthenticated)
}
async fn extract_user_id ( req : & ServiceRequest ) -> Result < Uuid , TelescopeError > { req // Get the identity of the service request -- this should be a json encoded authentication // cookie if it exists. . get_identity ( ) // Deserialize the authentication cookie object if it exists. . and_then ( | ident | serde_json :: from_str :: < AuthenticationCookie > ( ident . as_str ( ) ) . ok ( ) ) // If not authenticated, return an error indicating so. . ok_or ( TelescopeError :: NotAuthenticated ) ? // Refresh the cookie if necessary. . refresh ( ) . await ? // Get the RCOS user ID associated with the authenticated user. . get_user_id ( ) . await ? // Respond with an error if the user is not found. . ok_or ( TelescopeError :: NotAuthenticated ) }
Extract the RCOS user ID authenticated with a request or error.
Extract the RCOS user ID authenticated with a request or error .
req
&ServiceRequest
req
&ServiceRequest