glassfish
  1. glassfish
  2. GLASSFISH-16277

create-file-user isn't usable in embedded glassfish because it requires interactive password entry

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1, 3.1.1
    • Fix Version/s: 3.1.2, 4.0_b05, 4.0
    • Component/s: embedded
    • Labels:
      None

      Description

      Glassfish 3.1's "asadmin create-file-user" command forces password entry on stdin. While this is desirable for many situations, it completely breaks the use case of glassfish embedded. You can't enter stdin text when running commands with org.glassfish.embeddable.CommandRunner , and the "--password" argument has been helpfully removed.

        Activity

        Hide
        matthewcornell added a comment -

        I could not get Bhavanishankar's fix to work. I'm using glassfish-embedded-all-3.2-b06.jar and make this call:

        CommandResult result = commandRunner.run("create-file-user", "--groups", "user", "test_user");

        Which gets this error:

        Jun 4, 2012 10:35:11 AM com.sun.enterprise.v3.admin.CommandRunnerImpl injectParameters
        SEVERE: Cannot find userpassword in create-file-user command model, file a bug
        Jun 4, 2012 10:35:11 AM util.GlassFishServerHelper createUsersAndGroups
        INFO: * createUsersAndGroups(): create output: PlainTextActionReporterFAILUREorg.jvnet.hk2.component.UnsatisfiedDependencyException: injection failed on com.sun.enterprise.security.cli.CreateFileUser.userpassword with class java.lang.StringDescription: create-file-user commandCannot find userpassword in create-file-user command model, file a bug
        Usage: create-file-user
        [--authrealmname <authrealm_name>] [--target target]
        [--groups user_groups[:user_groups]*]
        [?|-help[=<help(default:false)>]] username

        The code to that point:

        GlassFishProperties gfProps = new GlassFishProperties();
        gfProps.setPort("http-listener", PORT);
        GLASSFISH = GlassFishRuntime.bootstrap().newGlassFish(gfProps);
        GLASSFISH.start();

        FYI This is blocking our development.

        Show
        matthewcornell added a comment - I could not get Bhavanishankar's fix to work. I'm using glassfish-embedded-all-3.2-b06.jar and make this call: CommandResult result = commandRunner.run("create-file-user", "--groups", "user", "test_user"); Which gets this error: Jun 4, 2012 10:35:11 AM com.sun.enterprise.v3.admin.CommandRunnerImpl injectParameters SEVERE: Cannot find userpassword in create-file-user command model, file a bug Jun 4, 2012 10:35:11 AM util.GlassFishServerHelper createUsersAndGroups INFO: * createUsersAndGroups(): create output: PlainTextActionReporterFAILUREorg.jvnet.hk2.component.UnsatisfiedDependencyException: injection failed on com.sun.enterprise.security.cli.CreateFileUser.userpassword with class java.lang.StringDescription: create-file-user commandCannot find userpassword in create-file-user command model, file a bug Usage: create-file-user [--authrealmname <authrealm_name>] [--target target] [--groups user_groups [:user_groups] *] [ ?| -help [=<help(default:false)>] ] username The code to that point: GlassFishProperties gfProps = new GlassFishProperties(); gfProps.setPort("http-listener", PORT); GLASSFISH = GlassFishRuntime.bootstrap().newGlassFish(gfProps); GLASSFISH.start(); FYI This is blocking our development.
        Hide
        atrajano added a comment -

        I am getting the same issue with Glassfish 4 as matthewcomell

        I am using the maven-embedded-glassfish-plugin

        Show
        atrajano added a comment - I am getting the same issue with Glassfish 4 as matthewcomell I am using the maven-embedded-glassfish-plugin
        Hide
        atrajano added a comment -

        I decided to use cargo for this, but it requires a workaround rather than using the cargo.servlet.users property https://jira.codehaus.org/browse/CARGO-1246

        Show
        atrajano added a comment - I decided to use cargo for this, but it requires a workaround rather than using the cargo.servlet.users property https://jira.codehaus.org/browse/CARGO-1246
        Hide
        dmatej added a comment -

        The problem still exists in Embedded Glassfish 4.1-SNAPSHOT!

        Show
        dmatej added a comment - The problem still exists in Embedded Glassfish 4.1-SNAPSHOT!
        Hide
        sysmat added a comment - - edited

        In 3.2
        <dependency>
        <groupId>org.glassfish.extras</groupId>
        <artifactId>glassfish-embedded-all</artifactId>
        <version>3.2-b06</version>
        <scope>test</scope>
        </dependency>

        You can create without promt like that:

        cmdResult = cmdRunner.run("create-file-user",
        "--echo=true",
        "--groups=service_admin",
        "--authrealmname=file",
        "--passwordfile=src/test/resources/META-INF/password.txt",
        "testSupport@test.si");

        and see if created:
        cmdResult = cmdRunner.run("list-file-users", "--echo=true");
        LOG.info("list-file-users1 = "+cmdResult.getOutput());

        But in 4.1
        <dependency>
        <groupId>org.glassfish.main.extras</groupId>
        <artifactId>glassfish-embedded-all</artifactId>
        <version>4.1</version>
        </dependency>

        this is not working. Bug and we have a lot of problems with Junit testing.

        //add user support to file realm
        cmdResult = cmdRunner.run("create-file-user",
        "--echo=true",
        "--groups=service_admin",
        "--authrealmname=file",
        "--passwordfile=src/test/resources/META-INF/password.txt",
        "testSupport@test.si");

        cmdResult = cmdRunner.run("list-file-users", "--echo=true");
        LOG.info("list-file-users2 = "+cmdResult.getOutput());
        LOG.info("create-file-user:Failure = "+cmdResult.getFailureCause());

        LOG:
        3250 [main] INFO si.arnes.predalnik.api.server.rest.test.BaseTest - list-file-users2 = PlainTextActionReporterSUCCESSNo monitoring data to report.
        create-file-user:Failure = PlainTextActionReporterFAILUREorg.jvnet.hk2.config.UnsatisfiedDependencyException: injection failed on com.sun.enterprise.security.cli.CreateFileUser.userpassword with class java.lang.StringDescription: create-file-user commandCannot find userpassword in create-file-user command model, file a bug

        Hm, still bugish

        Show
        sysmat added a comment - - edited In 3.2 <dependency> <groupId>org.glassfish.extras</groupId> <artifactId>glassfish-embedded-all</artifactId> <version>3.2-b06</version> <scope>test</scope> </dependency> You can create without promt like that: cmdResult = cmdRunner.run("create-file-user", "--echo=true", "--groups=service_admin", "--authrealmname=file", "--passwordfile=src/test/resources/META-INF/password.txt", "testSupport@test.si"); and see if created: cmdResult = cmdRunner.run("list-file-users", "--echo=true"); LOG.info("list-file-users1 = "+cmdResult.getOutput()); But in 4.1 <dependency> <groupId>org.glassfish.main.extras</groupId> <artifactId>glassfish-embedded-all</artifactId> <version>4.1</version> </dependency> this is not working. Bug and we have a lot of problems with Junit testing. //add user support to file realm cmdResult = cmdRunner.run("create-file-user", "--echo=true", "--groups=service_admin", "--authrealmname=file", "--passwordfile=src/test/resources/META-INF/password.txt", "testSupport@test.si"); cmdResult = cmdRunner.run("list-file-users", "--echo=true"); LOG.info("list-file-users2 = "+cmdResult.getOutput()); LOG.info("create-file-user:Failure = "+cmdResult.getFailureCause()); LOG: 3250 [main] INFO si.arnes.predalnik.api.server.rest.test.BaseTest - list-file-users2 = PlainTextActionReporterSUCCESSNo monitoring data to report. create-file-user:Failure = PlainTextActionReporterFAILUREorg.jvnet.hk2.config.UnsatisfiedDependencyException: injection failed on com.sun.enterprise.security.cli.CreateFileUser.userpassword with class java.lang.StringDescription: create-file-user commandCannot find userpassword in create-file-user command model, file a bug Hm, still bugish

          People

          • Assignee:
            Bhavanishankar
            Reporter:
            ringerc
          • Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: