Snippets Collections
// open api
    name = "Basic Auth",
    type = SecuritySchemeType.HTTP,
    scheme = "basic",
    description = "Basic Auth")

// security config 2 users
public class SecurityConfig extends WebSecurityConfigurerAdapter {

  public PasswordEncoder passwordEncoder() {
    return new BCryptPasswordEncoder();

  protected void configure(HttpSecurity http) throws Exception {
        .authenticationEntryPoint(new Http403ForbiddenEntryPoint())

  protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        .passwordEncoder(new BCryptPasswordEncoder())

// controllers
@SecurityRequirement(name = "Basic Auth")

Mon Mar 15 2021 17:15:39 GMT+0000 (UTC)

#spring #security

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension