2

Though similar, the specific problem I have is not addressed in Use JASPIC auth module on WebSphere 8.5

I am getting the following error message:

SECJ8027E: The path and name of file where JASPI persistent registrations are stored must be specified using property com.ibm.websphere.jaspi.configuration.

I can set the custom property in the administration to some existing folder but I wanted to make sure that is the right approach or if there is some step I was missing.

Note I am specifically using the "embedded in application" approach rather than a server installed JASPIC module so I have something like this

@WebListener
public class JaspicInitializer implements
    ServletContextListener {

    @Override
    public void contextInitialized(final ServletContextEvent sce) {

        final Map<String, String> options = new HashMap<>();
        AuthConfigFactory.getFactory()
            .registerConfigProvider(AuthModuleConfigProvider.class.getName(), options, "HttpServlet", null, null);
    }
}

I had the error on both WebSphere 8.5.5.11 and 9.0.0.3

Community
  • 1
  • 1
Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265
  • 2
    This might be a minor spec violation, for I can't recall the spec hinting that the factory may require proprietary configuration of any sort for provider registrations, whether persistent or not. Have you tried the more popular in-memory alternative, i.e., `#registerConfigProvider(AuthConfigProvider, String, String, String)` instead? Of course, if you absolutely need the ability to perform persistent registrations that are fully portable (including the actual persistence mechanism / representation), you could as well provide your own `AuthConfigFactory` implementation. – Uux May 04 '17 at 17:14
  • Oh I see the difference... took a bit. so shove in an instance then. – Archimedes Trajano May 04 '17 at 17:16
  • Well that solves one problem I don't get the error message anymore, but it does not get triggered either. I'll ask that in another question. – Archimedes Trajano May 04 '17 at 17:25

1 Answers1

2

From @Uux comment, I changed the way I do the registration so it no longer give the error.

@WebListener
public class JaspicInitializer implements
    ServletContextListener {

    private String registrationID;

    @Override
    public void contextDestroyed(final ServletContextEvent sce) {

        AuthConfigFactory.getFactory().removeRegistration(registrationID);
    }

    @Override
    public void contextInitialized(final ServletContextEvent sce) {

        final ServletContext context = sce.getServletContext();
        registrationID = AuthConfigFactory.getFactory()
            .registerConfigProvider(new AuthModuleConfigProvider(), "HttpServlet", 
              context.getVirtualServerName() + " " + context.getContextPath(), "JEE Sample");
    }
}

Also WebSphere Global Security needs to be configured with

  • Enable application security
  • Enable Java Authentication SPI (JASPI)

enter image description here

Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265