Skip to content

Switching to Google Oauth2 as authentication provider doesn't work properly #176

@abiuan

Description

@abiuan

Hello,
I'm developing a wicket web application that needs authentication. I'm using spring security for that.
Using an InMemoryUserDetailsManager works all fine. Switching to OAuth2 authentication doesn't work. The following exception:
IllegalStateException: Couln't find sign in page - please annotate the sign in page with @com.giffing.wicket.spring.boot.context.scan.WicketSignInPage
means that wicket is looking for a login page therefore it is unable to read authentication information from spring security context, I suppose.

I wrote a simple spring boot application with security, but without wicket-spring-boot, and It works, so I suppose is something related to wicket-spring-boot. Does it need a specific configuration for OAuth2? What I'm doing wrong?

Best regards

My security environment is quite simple:

I'm using @EnableAutoConfiguration on @SpringBootApplication class.
My application.yml is

security:
    oauth2:
      client:
        registration:
          google:
            clientId: myclentId
            clientSecret: myclientSecret
            scope:
              - email
              - profile

my WebSecurityConfigurerAdapter is

@EnableWebSecurity
public class HttpSecurityConfig {
	
	@Configuration
	public static class OAuth2WebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
		
		@Override
		protected void configure(HttpSecurity http) throws Exception {
			http.authorizeRequests()
				.anyRequest().authenticated()
				.and()
				.oauth2Login()
        	;
		}

		@Bean(name="authenticationManager")
		@Override
		public AuthenticationManager authenticationManagerBean() throws Exception {
			return super.authenticationManagerBean();
	    }
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions