Accessing web.xml Metadata from Tomcat

From NovaOrdis Knowledge Base
Jump to navigation Jump to search

Internal

Overview

<security-constraint>

web.xml <security-constraint> metadata is represented by org.apache.catalina.deploy.LoginConfig.

It can be accessed as follows (the code comes from org.apache.catalina.authenticator.AuthenticatorBase).

LoginConfig lc = contex.getLoginConfig();

<login-config>

web.xml <login-config> metadata is represented by org.apache.catalina.deploy.SecurityConstraint.

It can be accessed as follows (the code comes from org.apache.catalina.authenticator.AuthenticatorBase).

Realm realm = this.context.getRealm()
SecurityConstraint [] constraints = realm.findSecurityConstraints(request, this.context);