Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpringSecurityUserProviderConfiguration errantly triggers during autoconfiguration #173

Closed
wgorder opened this issue Jun 29, 2016 · 3 comments
Assignees
Labels
Milestone

Comments

@wgorder
Copy link

wgorder commented Jun 29, 2016

If you have spring-security on the classpath but do not include

        <dependency>
            <groupId>org.togglz</groupId>
            <artifactId>togglz-spring-security</artifactId>
            <version>2.3.0.RC2</version>
        </dependency>

Autoconfiguration will fail due to the way that the Conditional Beans are currently set up. In my case I do not wish to use Togglz security at all. Therefore the below block of code should be conditional on something that is brought in with the togglz-spring-security artifact to prevent it from activating otherwise.
I think @ConditionalOnClass({EnableWebSecurity.class, AuthenticationEntryPoint.class, SpringSecurityUserProvider.class}) would do the trick.

    @Configuration
    @ConditionalOnClass({EnableWebSecurity.class, AuthenticationEntryPoint.class})
    @ConditionalOnMissingBean(UserProvider.class)
    protected static class SpringSecurityUserProviderConfiguration {

        @Autowired
        private TogglzProperties properties;

        @Bean
        public UserProvider userProvider() {
            return new SpringSecurityUserProvider(properties.getConsole().getFeatureAdminAuthority());
        }
    }
@marceloverdijk
Copy link

What error are you getting? Would you be able to post a stacktrace?

@marceloverdijk
Copy link

Yes I think you are right about adding the SpringSecurityUserProvider class to the conditional on class.
I will push a change to master shortly.

marceloverdijk pushed a commit that referenced this issue Jun 30, 2016
@marceloverdijk
Copy link

Change is pushed to master and will be available in latest snapshot. Please watch https://travis-ci.org/togglz/togglz/builds/141267422.
Thanks for reporting this @wgorder!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants