Skip to content

Instantly share code, notes, and snippets.

@vegaasen
Created February 16, 2018 12:30
Show Gist options
  • Save vegaasen/668deaac762103ecd59bce15b44fb2d0 to your computer and use it in GitHub Desktop.
Save vegaasen/668deaac762103ecd59bce15b44fb2d0 to your computer and use it in GitHub Desktop.
Configuring OIM without any authwl.conf-file

OIM with no JAAS-file

Background

This is quite simple.

Most likely, you will be having a similar configuration to this defined in your authwl.conf-file:

xellerate{
    weblogic.security.auth.login.UsernamePasswordLoginModule
    required debug=true;
};

Additionally, you will also be needed to define a system property like this:

System.setProperty("java.security.auth.login.config", getPathToConfigurationFile(oimServer));

The point behind this file is that it actually holds the JAAS configuration in regards to connections made to OIM (allowing your client to speak as intended with OIM).

Java-code stuff

Instead of defining the file and a system parameter, just specify the following code instead:

import weblogic.security.auth.login.UsernamePasswordLoginModule;

import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.Configuration;
...
...
Configuration.setConfiguration(new Configuration() {
    @Override
    public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
        Preconditions.checkArgument("xellerate".equals(name));
        return new AppConfigurationEntry[]{new AppConfigurationEntry(UsernamePasswordLoginModule.class.getName(), AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, Collections.singletonMap("debug", "true"))};
    }
});
...
...

This is the same as having a file with the configuration.

Thank me later :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment