AuthenticationService's getUser() method should be able to handle a null response from the user service.
https://github.com/coldbox-modules/cbauth/blob/main/models/AuthenticationService.cfc#L152-L163 - it seems getUser() expects getUserService().retrieveUserById(...) to throw an error if the user cannot be found.
Instead, I'd prefer to handle null's as a missing user, and logout or clear the session val.
The context of this is that a logged-in user was deleted. (don't ask!)
I would be happy to PR something like this toAuthenticationService.cfc's getUser() method:
if ( isNull( userBean ) ){
variables.sessionStorage.delete( variables.USER_ID_KEY );
throw( "User not found" );
}
AuthenticationService's
getUser()method should be able to handle anullresponse from the user service.https://github.com/coldbox-modules/cbauth/blob/main/models/AuthenticationService.cfc#L152-L163 - it seems
getUser()expectsgetUserService().retrieveUserById(...)to throw an error if the user cannot be found.Instead, I'd prefer to handle
null's as a missing user, and logout or clear the session val.The context of this is that a logged-in user was deleted. (don't ask!)
I would be happy to PR something like this to
AuthenticationService.cfc'sgetUser()method: