From ee6c1f2dddbad7d4560d3321004d175b3ba2f06b Mon Sep 17 00:00:00 2001 From: Joe Grandja Date: Thu, 19 Oct 2017 12:01:55 -0400 Subject: [PATCH] Add temporary GlobalAuthenticationConfigurerAdapter Fixes gh-4664 --- ...GlobalAuthenticationConfigurerAdapter.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 samples/boot/oauth2login/src/main/java/org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.java diff --git a/samples/boot/oauth2login/src/main/java/org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.java b/samples/boot/oauth2login/src/main/java/org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.java new file mode 100644 index 0000000000..15948db984 --- /dev/null +++ b/samples/boot/oauth2login/src/main/java/org/springframework/security/config/annotation/authentication/configurers/GlobalAuthenticationConfigurerAdapter.java @@ -0,0 +1,48 @@ +/* + * Copyright 2002-2017 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.annotation.authentication.configurers; + +import org.springframework.core.annotation.Order; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.SecurityConfigurer; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; + +/** + * NOTE: + * This class is here as a TEMPORARY FIX in order to force + * @ConditionalOnClass(GlobalAuthenticationConfigurerAdapter.class) in + * org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration. + *

+ * Spring Boot M5 expects GlobalAuthenticationConfigurerAdapter to be located in package + * org.springframework.security.config.annotation.authentication.configurers. + * However, it's recently been moved to + * org.springframework.security.config.annotation.authentication.configuration + * resulting in SecurityAutoConfiguration NOT being triggered. + *

+ * This class should be removed after a fix has been applied to Spring Boot M6 or RC1. + * + * @author Joe Grandja + */ +@Order(100) +public abstract class GlobalAuthenticationConfigurerAdapter implements + SecurityConfigurer { + + public void init(AuthenticationManagerBuilder auth) throws Exception { + } + + public void configure(AuthenticationManagerBuilder auth) throws Exception { + } +}