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

Add Runtime Hints for basic setup #11431

Closed
marcusdacoregio opened this issue Jun 23, 2022 · 0 comments
Closed

Add Runtime Hints for basic setup #11431

marcusdacoregio opened this issue Jun 23, 2022 · 0 comments
Assignees
Labels
in: core An issue in spring-security-core type: enhancement A general enhancement
Milestone

Comments

@marcusdacoregio
Copy link
Contributor

marcusdacoregio commented Jun 23, 2022

When running the security sample in spring-native, it fails with the following error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationEventPublisher': Instantiation of supplied bean failed
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1234) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1209) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1156) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:566) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:526) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:225) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:1267) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:1228) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveBean(DefaultListableBeanFactory.java:483) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:338) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:331) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1159) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration.getBeanOrNull(AuthenticationConfiguration.java:194) ~[security:6.0.0-M5]
        at org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration.authenticationManagerBuilder(AuthenticationConfiguration.java:82) ~[security:6.0.0-M5]
        at org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration__BeanDefinitions.lambda$getAuthenticationManagerBuilderInstance$0(AuthenticationConfiguration__BeanDefinitions.java:46) ~[na:na]
        at org.springframework.util.function.ThrowingFunction.apply(ThrowingFunction.java:63) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.util.function.ThrowingFunction.apply(ThrowingFunction.java:51) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.aot.AutowiredInstantiationArgumentsResolver.resolve(AutowiredInstantiationArgumentsResolver.java:156) ~[na:na]
        at org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration__BeanDefinitions.getAuthenticationManagerBuilderInstance(AuthenticationConfiguration__BeanDefinitions.java:46) ~[na:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1223) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1209) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1156) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:566) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:526) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:930) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:926) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:592) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[security:3.0.0-SNAPSHOT]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:735) ~[security:3.0.0-SNAPSHOT]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:431) ~[security:3.0.0-SNAPSHOT]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[security:3.0.0-SNAPSHOT]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1307) ~[security:3.0.0-SNAPSHOT]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1296) ~[security:3.0.0-SNAPSHOT]
        at com.example.securingweb.SecuringWebApplication.main(SecuringWebApplication.java:10) ~[security:0.0.1-SNAPSHOT]
Caused by: java.lang.RuntimeException: Authentication event class org.springframework.security.authentication.event.AuthenticationFailureBadCredentialsEvent has no suitable constructor
        at org.springframework.security.authentication.DefaultAuthenticationEventPublisher.addMapping(DefaultAuthenticationEventPublisher.java:209) ~[security:6.0.0-M5]
        at org.springframework.security.authentication.DefaultAuthenticationEventPublisher.<init>(DefaultAuthenticationEventPublisher.java:82) ~[security:6.0.0-M5]
        at org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.authenticationEventPublisher(SecurityAutoConfiguration.java:49) ~[security:0.0.1-SNAPSHOT]
        at org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration__BeanDefinitions.lambda$getAuthenticationEventPublisherInstance$0(SecurityAutoConfiguration__BeanDefinitions.java:43) ~[na:na]
        at org.springframework.util.function.ThrowingFunction.apply(ThrowingFunction.java:63) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.util.function.ThrowingFunction.apply(ThrowingFunction.java:51) ~[security:6.0.0-SNAPSHOT]
        at org.springframework.beans.factory.aot.AutowiredInstantiationArgumentsResolver.resolve(AutowiredInstantiationArgumentsResolver.java:156) ~[na:na]
        at org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration__BeanDefinitions.getAuthenticationEventPublisherInstance(SecurityAutoConfiguration__BeanDefinitions.java:43) ~[na:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainInstanceFromSupplier(AbstractAutowireCapableBeanFactory.java:1223) ~[security:6.0.0-SNAPSHOT]
        ... 40 common frames omitted

We should add runtime hints to support the most basic setup in Spring Security

@marcusdacoregio marcusdacoregio added in: core An issue in spring-security-core type: enhancement A general enhancement labels Jun 23, 2022
@marcusdacoregio marcusdacoregio added this to the 6.0.0-M6 milestone Jun 23, 2022
@marcusdacoregio marcusdacoregio self-assigned this Jun 23, 2022
@marcusdacoregio marcusdacoregio added type: bug A general bug and removed type: enhancement A general enhancement labels Jun 23, 2022
marcusdacoregio added a commit to marcusdacoregio/spring-security that referenced this issue Jun 27, 2022
@marcusdacoregio marcusdacoregio added type: enhancement A general enhancement and removed type: bug A general bug labels Jun 28, 2022
@marcusdacoregio marcusdacoregio changed the title AuthenticationFailureBadCredentialsEvent has no suitable constructor Add Runtime Hints for basic setup Jun 28, 2022
marcusdacoregio added a commit that referenced this issue Jul 6, 2022
Use ParameterizedTest to simplify repetitive test setup

Issue gh-11431
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core An issue in spring-security-core type: enhancement A general enhancement
Projects
Status: Done
Development

No branches or pull requests

1 participant