apiapiman

New User Register option is not coming over UI


I have installed api man as defined in http://www.apiman.io/latest/download.html

I performed following instructions.

mkdir ~/apiman-1.2.5.Final
cd ~/apiman-1.2.5.Final
curl http://download.jboss.org/wildfly/10.0.0.Final/wildfly-10.0.0.Final.zip -o wildfly-10.0.0.Final.zip
curl http://downloads.jboss.org/apiman/1.2.5.Final/apiman-distro-wildfly10-1.2.5.Final-overlay.zip -o apiman-distro-wildfly10-1.2.5.Final-overlay.zip
unzip wildfly-10.0.0.Final.zip
unzip -o apiman-distro-wildfly10-1.2.5.Final-overlay.zip -d wildfly-10.0.0.Final
cd wildfly-10.0.0.Final
./bin/standalone.sh -c standalone-apiman.xml

after this i can login as a admin that is predefined and create organisation, apis and rest.

but at login page New User Registration option is not coming. here login page snap enter image description here

How can i get new user register option ? .I am using apache tomcat. Here is snap what is missing enter image description here

"Register?New User" option is not coming


Solution

  • Rationale

    In our WildFly distributions we use Keycloak for identity management and auth; it's all rolled into a single server including all of apiman's components and Keycloak. However, Keycloak can't run on Tomcat, so by default our Tomcat quickstart just uses tomcat's inbuilt auth mechanisms (which you can configure to use LDAP, JDBC, etc).

    So, if you want Keycloak plus apiman, you need to do a little bit of extra work. However, this brings a lot of capabilities, so it's likely worth it for real deployments.

    Bear in mind that this is slighly verbose to describe, but actually rather quick to implement.

    Naturally, just using the WildFly all-in-one might be less hassle, especially for a quick test :-).

    I'll add this to the apiman documentation shortly.

    Using Keycloak IDM with apiman on Tomcat

    Get Keycloak running

    Prepare Tomcat

    The generic instructions are available in the Keycloak documentation, but I'll endeavour to provide more specialised config information.

    Modify apiman

    Extract apiman.war, apimanui.war, and apiman-gateway-api.war and add the following:

    In apiman.war:

    <Context path="/apiman">
        <Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
    </Context>
    

    In apimanui.war

    <Context path="/apimanui">
        <Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
    </Context>
    

    In apiman-gateway-api.war

    <Context path="/apiman-gateway-api">
        <Valve className="org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve"/>
    </Context>
    

    In apiman.war:

    {
        "realm": "apiman",
        "resource": "apiman",
        "realm-public-key": "<YOUR REALM'S PUBLIC KEY>",
        "auth-server-url": "http://localhost:9080/auth",
        "ssl-required": "none",
        "use-resource-role-mappings": false,
        "enable-cors": true,
        "cors-max-age": 1000,
        "cors-allowed-methods": "POST, PUT, DELETE, GET",
        "bearer-only": false,
        "enable-basic-auth": true,
        "expose-token": true,
        "credentials" : {
          "secret" : "<APIMAN SECRET HERE, IF ANY>"
        },
        "connection-pool-size": 20,
        "principal-attribute": "preferred_username"
    }
    

    In apimanui.war, config as above, but with:

    {
        "realm": "apiman",
        "resource": "apimanui",
        "realm-public-key": "<YOUR REALM'S PUBLIC KEY>",
        ...
        "credentials" : {
          "secret" : "<APIMANUI SECRET HERE, IF ANY>"
        },
        "principal-attribute": "preferred_username"
    }
    

    In apiman-gateway-api.war, config as above, but with:

    {
        "realm": "apiman",
        "resource": "apiman-gateway-api",
        "realm-public-key": "<YOUR REALM'S PUBLIC KEY>",
        ...
        "credentials" : {
          "secret" : "<APIMAN-GATEWAY-API SECRET HERE, IF ANY>"
        },
        "principal-attribute": "preferred_username"
    }
    

    For all of the above, replace the login-config section with:

    <login-config>
      <auth-method>BASIC</auth-method>
      <realm-name>apiman</realm-name>
    </login-config>
    

    Other issues

    You may want to copy over themes (or make your own). It's rather easy, but out of the scope of this response.