Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix unit test failures

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1079769 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Mar 9, 2011
1 parent 4348544 commit 9c90bdc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
7 changes: 6 additions & 1 deletion java/org/apache/catalina/core/StandardWrapper.java
Expand Up @@ -1145,9 +1145,14 @@ private void processServletSecurityAnnotation(Servlet servlet) {
// Calling this twice isn't harmful so no syncs
servletSecurityAnnotationScanRequired = false;

Context ctxt = (Context) getParent();

if (ctxt.getIgnoreAnnotations()) {
return;
}

ServletSecurity secAnnotation =
servlet.getClass().getAnnotation(ServletSecurity.class);
Context ctxt = (Context) getParent();
if (secAnnotation != null) {
ctxt.addServletSecurity(
new ApplicationServletRegistration(this, ctxt),
Expand Down
11 changes: 8 additions & 3 deletions java/org/apache/catalina/startup/ContextConfig.java
Expand Up @@ -366,11 +366,16 @@ protected void applicationAnnotationsConfig() {
*/
protected synchronized void authenticatorConfig() {

// Always need an authenticator to support @ServletSecurity annotations
LoginConfig loginConfig = context.getLoginConfig();
if (loginConfig == null) {
loginConfig = DUMMY_LOGIN_CONFIG;
context.setLoginConfig(loginConfig);
if (context.getIgnoreAnnotations()) {
return;
} else {
// Not metadata-complete, need an authenticator to support
// @ServletSecurity annotations
loginConfig = DUMMY_LOGIN_CONFIG;
context.setLoginConfig(loginConfig);
}
}

// Has an authenticator been configured already?
Expand Down
3 changes: 3 additions & 0 deletions test/webapp-3.0/WEB-INF/web.xml
Expand Up @@ -113,4 +113,7 @@
<url-pattern>/testStandardWrapper/securityAnnotationsMetaDataPriority</url-pattern>
</servlet-mapping>

<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>

0 comments on commit 9c90bdc

Please sign in to comment.