Skip to content

Commit 0f29d11

Browse files
jgrandjamohammedBalhaddad
authored andcommitted
Order highest precedence for OAuth2AuthorizationServerSecurity
Closes spring-projectsgh-103
1 parent d554787 commit 0f29d11

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2020 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.security.config.annotation.web.configuration;
17+
18+
import org.junit.Test;
19+
import org.springframework.core.Ordered;
20+
import org.springframework.core.annotation.OrderUtils;
21+
22+
import static org.assertj.core.api.Assertions.assertThat;
23+
24+
/**
25+
* Tests for {@link OAuth2AuthorizationServerSecurity}.
26+
*
27+
* @author Joe Grandja
28+
*/
29+
public class OAuth2AuthorizationServerSecurityTests {
30+
31+
@Test
32+
public void assertOrderHighestPrecedence() {
33+
Integer authorizationServerSecurityOrder = OrderUtils.getOrder(OAuth2AuthorizationServerSecurity.class);
34+
Integer defaultSecurityOrder = OrderUtils.getOrder(WebSecurityConfigurerAdapter.class);
35+
assertThat(authorizationServerSecurityOrder).isNotEqualTo(defaultSecurityOrder);
36+
assertThat(authorizationServerSecurityOrder).isEqualTo(Ordered.HIGHEST_PRECEDENCE);
37+
}
38+
39+
}

0 commit comments

Comments
 (0)