code: protected String encryptResolvedUsername(final Principal principal, final Service service, final RegisteredService registeredService, final String username) {
          val applicationContext = ApplicationContextProvider.getApplicationContext();
          val cipher = applicationContext.getBean("registeredServiceCipherExecutor", RegisteredServiceCipherExecutor.class);
          return cipher.encode(username, Optional.of(registeredService));
      }
docs: Encrypt resolved username.
  
  @param principal         the principal
  @param service           the service
  @param registeredService the registered service
  @param username          the username
  @return the encrypted username or null