@Override
    protected void runSecuredCommand(final Bootstrap<Config> bootstrap,
                                     final Namespace namespace,
                                     final Config config,
                                     final Injector injector) {

        injector.injectMembers(this);

        final String username = namespace.getString(USERNAME_ARG_NAME);

        accountService.read(username)
                .ifPresentOrElse(
                        account -> {
                            final String msg = LogUtil.message("An account for user '{}' already exists",
                                    username);
                            logEvent(username, false, msg);
                            throw new RuntimeException(msg);
                        },
                        () -> {
                            createAccount(namespace, username);
                            final String msg = LogUtil.message("Account creation complete for user '{}'",
                                    username);
                            info(LOGGER, msg);
                            logEvent(username, true, msg);
                        });
    }
Creates an account in the internal identity provider
stroom-app/src/main/java/stroom/app/commands/CreateAccountCommand.java