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
Closed
Assignees
Labels
bug
Milestone

Comments

@wgorder
Copy link

@wgorder 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

@marceloverdijk marceloverdijk commented Jun 29, 2016

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

@marceloverdijk
Copy link

@marceloverdijk marceloverdijk commented Jun 30, 2016

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
…roviderConfiguration (#173)
@marceloverdijk
Copy link

@marceloverdijk marceloverdijk commented Jun 30, 2016

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!

@marceloverdijk marceloverdijk added the bug label Jun 30, 2016
@chkal chkal added this to the 2.3.0.Final milestone Jun 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.