Skip to content

Add stateless authentication option to VaadinWebSecurityConfigurerAdapter #807

@haijian-vaadin

Description

@haijian-vaadin

We have a VaadinWebSecurityConfigurerAdapter which helps with the session based authentications. Would be good to have an option there to help with JWT based stateless authentication, so that when a user wants to use stateless authentication, they could have their own SecurityConfig class by just extending from the VaadinWebSecurityConfigurerAdapter.

public class SecurityConfig extends VaadinWebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        // @formatter:off
        super.configure(http);

        http
                .csrf().disable()
                .sessionManagement()
                    .sessionCreationPolicy(SessionCreationPolicy.STATELESS);

        setJwtSplitCookieAuthentication(http, "myapp", 3600,
                JWSAlgorithm.HS256);
        setLoginView(http, "/login", "/logout");
        // @formatter:on
    }
}

Metadata

Metadata

Assignees

Labels

fusionChanges required for fusion

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions