/*
 * Copyright 2017 michael-simons.eu.
 *
 * 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 ac.simons.spring.boot.singleuser.autoconfigure;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.config.annotation.authentication.configurers.GlobalAuthenticationConfigurerAdapter;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;

/**
 * Provides the auto-configuration of one single, user. This configuration is
 * dependent on having Spring Security Core on the classpath (represented by the
 * AuthenticatenManager) and also Spring Security Configuration (represented by
 * the GlobalAuthenticationConfigurerAdapter).
 *
 * @author Michael J. Simons, 2017-10-14
 */
@Configuration
@ConditionalOnClass({AuthenticationManager.class, GlobalAuthenticationConfigurerAdapter.class})
public class SingleUserAutoConfiguration {

    @ConditionalOnMissingBean({AuthenticationManager.class, AuthenticationProvider.class, UserDetailsService.class})
    @Bean
    public InMemoryUserDetailsManager singleUserDetailsMananger() throws Exception {
        return new InMemoryUserDetailsManager(
                User.withUsername("user").password("foo").roles().build());
    }
}

@@ -653,16 +653,83 @@
 igure;%0A%0A
+import org.springframework.boot.autoconfigure.AutoConfigureBefore;%0A
 import o
@@ -874,24 +874,106 @@
 issingBean;%0A
+import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;%0A
 import org.s
@@ -2001,16 +2001,70 @@
 class%7D)%0A
+@AutoConfigureBefore(SecurityAutoConfiguration.class)%0A
 public c

Make sure this configuration is applied before Spring Security