Web UI Pre-Authentication

It is possible to configure Meridian to run behind a proxy that provides authentication, and then pass the pre-authenticated user to the Meridianwebapp using a header.

Define the pre-authentication configuration in $OPENNMS_HOME/jetty-webapps/opennms/WEB-INF/spring-security.d/header-preauth.xml. This file is automatically included in the Spring security context, but is not enabled by default.

Do not configure Meridian this way unless you are certain the web UI is accessible only to the proxy and not to end users. Otherwise, malicious attackers can craft queries that include the pre-authentication header and get full control of the web UI and REST APIs.

Enabling pre-authentication

Edit the header-preauth.xml file, and set the enabled property:

<beans:property name="enabled" value="true" />

Configuring pre-authentication

You can also set the following properties to change the behavior of the pre-authentication plugin:

Property Description Default


Whether the pre-authentication plugin is active.



If true, disallow login if the header is not set or the user does not exist. If false, fall through to other mechanisms (basic auth, form login, and so on.)



The HTTP header that will specify the user to authenticate as.



A comma-separated list of additional credentials (roles) the user should have.



The HTTP header that will contain a comma-separated list of authorities (roles) the user will have.


Enabling pre-authorization

Modify jetty-webapps/opennms/WEB-INF/applicationContext-spring-security.xml, and set:

<beans:bean id="preauthAuthProvider" class="org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider">
  <beans:property name="preAuthenticatedUserDetailsService">
    <beans:bean id="preAuthUserDetailsService" class="org.springframework.security.web.authentication.preauth.PreAuthenticatedGrantedAuthoritiesUserDetailsService"/>

You can then try testing with:

curl -H "X-Remote-User: myuser" -H "X-Remote-Role: ROLE_USER,ROLE_REST" http://localhost:8980/opennms/rest/whoami