Skip to content

How to run Gluu on jetty 10

Jose edited this page Aug 27, 2021 · 5 revisions

I applied the below configs to oxauth and oxtrust only. I tested the following and no problem was presented:

  • Start the applications
  • Retrieve the openid-configuration URL
  • Retrieve static content (eg. http://.../oxauth/ext/resources/some_resource.png)
  • Login to oxTrust, create a client, edit scopes, logout
  • Obtain oauth tokens via curl (with created client) + instrospecting them
  • Change oxauth log level via LDAP and verify proper log statements appeared
  • Enable and disable cust scrips via LDAP and verify proper log statements appeared

Notes:

  • Installation made using gluu_install.py --jetty-version 10.0.6
  • Examples given for oxauth. Other apps should do the same

oxauth.war#WEB-INF/jetty-env.xml

  • Change DTD declaration to: <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">

  • Change <Ref id="webAppCtx" /> with <Ref refid="webAppCtx" />

oxauth.war#WEB-INF/jetty-web.xml

  • Remove this file

(Optional) webapps/oxauth.xml and webapps/oxauth_web_resources.xml

  • Update DTD as above

Jetty params

Apparently there is no single start.ini file anymore. There are per-module ini files inside $JETTY_BASE/start.d directory:

  • Add line jetty.httpConfig.sendServerVersion=false at the bottom of http.ini. Response headers will show the Apache (not Jetty) version
  • Add cdi-decorate module to jetty base, eg: java -jar $JETTY_HOME/start.jar --add-to-start=cdi-decorate

Alternative to cdi-decorate

If for some reason we don't want to add such module we can use oxauth.war#WEB-INF/jetty-web.xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">

	<Get name="systemClassMatcher">
		<Call name="exclude">
			<Arg>javax.mail.</Arg>
		</Call>
	</Get>

	<Get name="serverClassMatcher">
		<Call name="add">
			<Arg>javax.mail.</Arg>
		</Call>
	</Get>

	<Get name="serverClassMatcher">
		<Call name="exclude">
			<Arg>org.eclipse.jetty.util.Decorator</Arg>
		</Call>
	</Get> 	

	<Get name="serverClassMatcher">
		<Call name="exclude">
			<Arg>org.eclipse.jetty.util.DecoratedObjectFactory</Arg>
		</Call>
	</Get> 

	<Get name="serverClassMatcher">
		<Call name="exclude">
			<Arg>org.eclipse.jetty.server.handler.ContextHandler.</Arg>
		</Call>
	</Get>
 	
	<Get name="serverClassMatcher">
		<Call name="exclude">
			<Arg>org.eclipse.jetty.server.handler.ContextHandler</Arg>
		</Call>
	</Get>
	
	<Get name="serverClassMatcher">
		<Call name="exclude">
			<Arg>org.eclipse.jetty.servlet.ServletContextHandler</Arg>
		</Call>
	</Get>
</Configure>

This is an older hack to make internal jetty APIs visible so Weld can work.