@@ -7563,33 +7563,17 @@ impl NexusExternalApi for NexusExternalApiImpl {
7563
7563
let apictx = rqctx. context ( ) ;
7564
7564
let handler = async {
7565
7565
let nexus = & apictx. context . nexus ;
7566
- // this is unique among the hundreds of calls to this function in
7567
- // that we are not using ? to return early on error
7568
- let opctx =
7569
- crate :: context :: op_context_for_external_api ( & rqctx ) . await ;
7566
+ // this is kind of a weird one, but we're only doing things here
7567
+ // that are authorized directly by the possession of the token,
7568
+ // which makes it somewhat like a login
7569
+ let opctx = nexus . opctx_external_authn ( ) ;
7570
7570
let session_cookie =
7571
7571
cookies. get ( session_cookie:: SESSION_COOKIE_COOKIE_NAME ) ;
7572
7572
7573
- // Look up session and delete it if present. Noop on any errors.
7574
- // This is the ONE spot where we do the hard delete by token and we
7575
- // haven't already looked up the session by token. Looking up the
7576
- // token first works, but it would be nice to avoid it.
7577
- if let Ok ( opctx) = opctx {
7578
- if let Some ( cookie) = session_cookie {
7579
- let token = cookie. value ( ) . to_string ( ) ;
7580
- match nexus. session_fetch ( & opctx, token) . await {
7581
- Ok ( session) => {
7582
- let id = session. console_session . id ( ) ;
7583
- // ? here because if this fails, we did not delete the
7584
- // session when we meant to
7585
- nexus. session_hard_delete ( & opctx, id) . await ?;
7586
- }
7587
- // blow up only on errors other than not found, because not
7588
- // found is fine: nothing to delete
7589
- Err ( Error :: ObjectNotFound { .. } ) => { } // noop
7590
- Err ( e) => return Err ( e. into ( ) ) ,
7591
- } ;
7592
- }
7573
+ // Look up session and delete it if present
7574
+ if let Some ( cookie) = session_cookie {
7575
+ let token = cookie. value ( ) . to_string ( ) ;
7576
+ nexus. session_hard_delete_by_token ( & opctx, token) . await ?;
7593
7577
}
7594
7578
7595
7579
// If user's session was already expired, they fail auth and their
0 commit comments