SEC-1980: Prevent parser warning when URL's in configuration start with #

Previously a warning would be logged to the parser when a URL was
configured with a SpEL expression. These changes prevent warnings from
being logged when using SpEL for URL configuration.
This commit is contained in:
Rob Winch
2012-07-10 14:24:42 -05:00
parent b28e3a0b2f
commit 42b72bcbc4
3 changed files with 80 additions and 2 deletions

View File

@@ -0,0 +1,42 @@
/*
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.security.config.http;
import static org.mockito.Mockito.verifyZeroInteractions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PrepareOnlyThisForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.springframework.beans.factory.xml.ParserContext;
@RunWith(PowerMockRunner.class)
@PrepareOnlyThisForTest(ParserContext.class)
public class WebConfigUtilsTest {
public final static String URL = "/url";
@Mock
private ParserContext parserContext;
// SEC-1980
@Test
public void validateHttpRedirectSpELNoParserWarning() {
WebConfigUtils.validateHttpRedirect("#{T(org.springframework.security.config.http.WebConfigUtilsTest).URL}", parserContext, "fakeSource");
verifyZeroInteractions(parserContext);
}
}