Example usage for org.springframework.security.config.annotation.web.builders HttpSecurity httpBasic

List of usage examples for org.springframework.security.config.annotation.web.builders HttpSecurity httpBasic

Introduction

In this page you can find the example usage for org.springframework.security.config.annotation.web.builders HttpSecurity httpBasic.

Prototype

public HttpBasicConfigurer<HttpSecurity> httpBasic() throws Exception 

Source Link

Document

Configures HTTP Basic authentication.

Usage

From source file:com.lennonjesus.auth.security.SecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.httpBasic().realmName("com.lennonjesus").and().exceptionHandling()
            .authenticationEntryPoint(authenticationEntryPoint).and().authorizeRequests().antMatchers("/")
            .permitAll().and().formLogin().loginProcessingUrl("/api/authentication")
            .successHandler(ajaxAuthenticationSuccessHandler).failureHandler(ajaxAuthenticationFailureHandler)
            .permitAll().and().logout().logoutUrl("/api/logout").logoutSuccessHandler(ajaxLogoutSuccessHandler)
            .deleteCookies("JSESSIONID").permitAll().and().authorizeRequests()
            .antMatchers("/api/authentication").permitAll().antMatchers("/api/authenticate").permitAll()
            //                .antMatchers("/api/v2/api-docs").permitAll()
            //                .antMatchers("/api/**").hasAnyAuthority("ROLE_USER")
            .anyRequest().authenticated().and().csrf().disable().headers().frameOptions().disable();

    //        .usernameParameter("j_username")
    //                .passwordParameter("j_password")
}

From source file:com.angular2.security.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().anyRequest().fullyAuthenticated();
    http.httpBasic();
    http.csrf().disable();/*from  w ww  .j a  v a 2s.com*/
}

From source file:io.getlime.push.configuration.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().anyRequest().anonymous();
    http.httpBasic().disable();
    http.csrf().disable();/*from w w  w.j  a  va  2 s.c o m*/
}

From source file:hu.fnf.devel.wishbox.gateway.SecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().anyRequest().fullyAuthenticated();

    http.httpBasic();

    http.csrf().disable();//  w w w .  j  a  va  2s.com
}

From source file:runtheshow.frontend.config.SecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    // @formatter:off
    http.httpBasic().and().logout().and().authorizeRequests()
            .antMatchers("/index.html", "/", "/login", "/message", "/home", "/resource/user/add",
                    "/artist_cv_consult", "/tests")
            .permitAll().antMatchers("/user", "/event", "/userprofile", "/artist_cv_edit").authenticated()
            .antMatchers("/resource/user/**", "/resource/artiste/current").authenticated().and().csrf()
            .csrfTokenRepository(csrfTokenRepository()).and()
            .addFilterAfter(csrfHeaderFilter(), CsrfFilter.class);
}

From source file:br.com.d4j.apostei.api.SecurityConfiguration.java

/**
 * {@inheritDoc}//  www .j a  v  a  2  s.co  m
 */
@Override
protected void configure(HttpSecurity http) throws Exception {

    // http.httpBasic().and().authorizeRequests().//
    // antMatchers("/", "/**").permitAll().anyRequest().permitAll();

    http.httpBasic().and().authorizeRequests().//
            and().formLogin().loginPage("/login").permitAll().//
            and().logout().permitAll().and().authorizeRequests().//
            antMatchers(HttpMethod.GET, "/post/**").hasRole("ADMIN").//
            antMatchers("/", "/**").permitAll().anyRequest().authenticated().//
            and().csrf().disable();
}

From source file:eu.supersede.fe.security.SecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.httpBasic().and().authorizeRequests().antMatchers(PERMIT_URLS).permitAll().anyRequest().authenticated()
            .and().csrf().csrfTokenRepository(csrfTokenRepository()).and()
            .addFilterAfter(csrfHeaderFilter(), CsrfFilter.class);
}

From source file:com.toptal.conf.SecurityConfiguration.java

@Override
protected final void configure(final HttpSecurity http) throws Exception {
    final String format = "%s/*";
    http.csrf().disable();//from   ww w . ja  v a  2  s .com
    http.httpBasic();
    http.authorizeRequests().antMatchers(HttpMethod.POST, SignupController.PATH).anonymous()
            .antMatchers(UserController.PATH).hasRole(Role.ROLE_MANAGER.text())
            .antMatchers(String.format(format, UserController.PATH)).hasRole(Role.ROLE_MANAGER.text())
            .antMatchers(EntryController.PATH).hasRole(Role.ROLE_USER.text())
            .antMatchers(String.format(format, EntryController.PATH)).hasRole(Role.ROLE_USER.text());
}

From source file:de.kaiserpfalzEdv.office.ui.web.configuration.WebSecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    LOG.debug("Configuring HTTP Security: {}", http);

    // all requests are authenticated
    http.authorizeRequests().anyRequest().authenticated();

    http.httpBasic();

    // Vaadin chokes if this filter is enabled, disable it!
    http.csrf().disable();//from  w  w w.j a  v a 2s.  c  om

    // TODO plumb custom HTTP 403 and 404 pages
    /* http.exceptionHandling().accessDeniedPage("/access?error"); */
}

From source file:ru.langboost.config.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    //        http.authorizeRequests()
    //                .antMatchers("/protected/**").access("hasRole('ROLE_ADMIN')");
    http.csrf().disable();// 
    http.formLogin().loginPage("/login").defaultSuccessUrl("/", false);
    http.httpBasic().realmName("Protected API");
    //        http.authorizeRequests().anyRequest();
}