Why PullRequestRescopedEvent returns anonymous user?

When I’m listening to Rescoped Event I check if the user is not anonymous.

@EventListener
public void onPullRequestRescoped(PullRequestRescopedEvent event) {

    ApplicationUser user = this.authenticationContext.getCurrentUser();
    boolean isAuth = this.authenticationContext.isAuthenticated();
    
    if (user == null) {
        return;
    }

   ...do something here when the user is not anonymous...
}

in that code user always is null even if another listeners return user = InternalNormalUser{id=2, username=julia}

What’ the problem with PullRequestRescopedEvent? Does anyone know?

Thank you very much in advance
Julia

Simply try getting the user from the event:

event.getUser();

https://docs.atlassian.com/bitbucket-server/javadoc/4.7.1/api/reference/com/atlassian/bitbucket/event/ApplicationEvent.html#getUser()