protected String retrieveUserName(Authentication authentication) {
        if (isInstanceOfUserDetails(authentication)) {
            return ((UserDetails) authentication.getPrincipal()).getUsername();
        }
        return authentication.getPrincipal().toString();
    }
@Test
    void retrieveUserName() {
        var authentication = new TestingAuthenticationToken("fake-user", "test");
        var username = tokenBasedRememberMeServices.retrieveUserName(authentication);

        var userDetails = new User("zhangsan", "test", List.of());
        authentication = new TestingAuthenticationToken(userDetails, "test");
        username = tokenBasedRememberMeServices.retrieveUserName(authentication);
        assertThat(username).isEqualTo("zhangsan");
    }