@@ -243,13 +243,16 @@ public async Task DeleteUserAsync(AccessContext context, DeleteUserRequest reque
243243 foreach ( var profile in profiles )
244244 {
245245 var key = new UserProfileKey ( context . ResourceTenant , profile . UserKey , profile . ProfileKey ) ;
246- await profileStore . DeleteAsync ( key , profile . Version , DeleteMode . Soft , now , innerCt ) ;
246+ await profileStore . DeleteAsync ( key , profile . Version , request . Mode , now , innerCt ) ;
247247 }
248248
249249 foreach ( var integration in _integrations )
250250 {
251251 await integration . OnUserDeletedAsync ( context . ResourceTenant , targetUserKey , request . Mode , innerCt ) ;
252252 }
253+
254+ var sessionStore = _sessionStoreFactory . Create ( context . ResourceTenant ) ;
255+ await sessionStore . RevokeAllChainsAsync ( targetUserKey , now , innerCt ) ;
253256 } ) ;
254257
255258 await _accessOrchestrator . ExecuteAsync ( context , command , ct ) ;
@@ -572,20 +575,24 @@ public async Task UpdateUserIdentifierAsync(AccessContext context, UpdateUserIde
572575 throw new UAuthIdentifierValidationException ( "username_change_not_allowed" ) ;
573576 }
574577
575- var validationDto = identifier . ToDto ( ) ;
576- var validationResult = await _identifierValidator . ValidateAsync ( context , validationDto , innerCt ) ;
577- if ( validationResult . IsValid != true )
578- {
579- throw new UAuthValidationException ( string . Join ( ", " , validationResult . Errors ) ) ;
580- }
581-
582578 var normalized = _identifierNormalizer . Normalize ( identifier . Type , request . NewValue ) ;
583579 if ( ! normalized . IsValid )
584580 throw new UAuthIdentifierValidationException ( normalized . ErrorCode ?? "identifier_invalid" ) ;
585581
586582 if ( string . Equals ( identifier . NormalizedValue , normalized . Normalized , StringComparison . Ordinal ) )
587583 throw new UAuthIdentifierValidationException ( "identifier_value_unchanged" ) ;
588584
585+ var validationDto = identifier . ToDto ( ) ;
586+ validationDto . Value = request . NewValue ;
587+ validationDto . NormalizedValue = normalized . Normalized ;
588+
589+ var validationResult = await _identifierValidator . ValidateAsync ( context , validationDto , innerCt ) ;
590+
591+ if ( ! validationResult . IsValid )
592+ {
593+ throw new UAuthValidationException ( string . Join ( ", " , validationResult . Errors ) ) ;
594+ }
595+
589596 var withinUserResult = await identifierStore . ExistsAsync (
590597 new IdentifierExistenceQuery (
591598 identifier . Type ,
0 commit comments