1

I am trying to dynamically share a page on facebook by using

th:data-href="'https://example.com/example/' + ${example.getId()}"

When this is shared it is a link to my sites login page which makes me think it is something not configured for anonymous users in my SecurityConfiguration. After logging in it does successfully forward to the shared link but I want visitors to see the shared link, not the login page.

@Override
    protected void configure(HttpSecurity http) throws Exception {
        // define how to login
        http.formLogin()
                .loginPage("/login")
                .defaultSuccessUrl("/profile")
                .permitAll()

                // logout configuration
                .and()
                    .logout()
                    .invalidateHttpSession(true)
                    .deleteCookies("JSESSIONID")
                    .logoutSuccessUrl("/")

                // define pages where you don't have to be logged in
                .and()
                    .authorizeRequests()
                    .antMatchers("/", "/register", "/login", "/search", "/logout", "/example/*")
                    .permitAll()

                // define pages that require users to be logged in
                .and()
                    .authorizeRequests()
                    .antMatchers("/profile", "/profile/edit", "/example-create", "/memory")
                    .authenticated();
    }

Do I need to add something so Anonymous users can go straight to the shared link?

4

0 回答 0