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:de.dominikschadow.javasecurity.csrf.config.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.httpBasic().disable();
}

From source file:com.github.wnameless.spring.papertrail.test.jpa.JpaSecutityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.httpBasic();
    http.csrf().disable();
}

From source file:org.moserp.infrastructure.authentication.LoginConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.httpBasic().and().requestMatchers().antMatchers("/login", "/oauth/authorize", "/oauth/confirm_access")
            .and().authorizeRequests().anyRequest().authenticated();
}

From source file:io.getlime.security.powerauth.app.rest.api.spring.configuration.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.httpBasic().disable();
    http.csrf().disable();/*from   w  w  w. j  a v  a  2s.  co  m*/
    http.authorizeRequests().antMatchers("/secured/**").fullyAuthenticated();
    http.exceptionHandling().authenticationEntryPoint(apiAuthenticationEntryPoint);
}

From source file:co.edu.utb.softeng.springtodos.config.security.SecurityConfiguration.java

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

From source file:pl.szcze.userserviceproject.SecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.httpBasic().and().addFilterAfter(CsrfHeaderFilter, CsrfFilter.class).csrf()
            .csrfTokenRepository(csrfTokenRepository());
}

From source file:io.interface21.SecurityConfiguration.java

/**
 * {@inheritDoc}/*from   ww  w. j a v a 2s.  co m*/
 */
@Override
protected void configure(HttpSecurity http) throws Exception {
    http.httpBasic().and().authorizeRequests().antMatchers("/index.html", "/sec/logout", "/").permitAll()
            .anyRequest().authenticated()
            /*.and()
            .formLogin()
            .loginProcessingUrl("/sec/login")*/
            .and().logout().logoutUrl("/sec/logout").and()
            .addFilterAfter(new CsrfHeaderFilter(), CsrfFilter.class).csrf()
            .csrfTokenRepository(csrfTokenRepository());
}

From source file:example.company.SecurityConfiguration.java

/**
 * This section defines the security policy for the app.
 * <p>//from   w w w.  ja v  a2  s .  c o m
 * <ul>
 * <li>BASIC authentication is supported (enough for this REST-based demo).</li>
 * <li>/employees is secured using URL security shown below.</li>
 * <li>CSRF headers are disabled since we are only testing the REST interface, not a web one.</li>
 * </ul>
 * NOTE: GET is not shown which defaults to permitted.
 *
 * @param http
 * @throws Exception
 * @see org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter#configure(org.springframework.security.config.annotation.web.builders.HttpSecurity)
 */
@Override
protected void configure(HttpSecurity http) throws Exception {

    http.httpBasic().and().authorizeRequests().//
            antMatchers(HttpMethod.POST, "/employees").hasRole("ADMIN").//
            antMatchers(HttpMethod.PUT, "/employees/**").hasRole("ADMIN").//
            antMatchers(HttpMethod.PATCH, "/employees/**").hasRole("ADMIN").and().//
            csrf().disable();
}

From source file:library.SecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {

    http.httpBasic().and().authorizeRequests().antMatchers(HttpMethod.DELETE, "/user/delete").hasRole("ADMIN")
            .antMatchers(HttpMethod.DELETE, "/user/passBook").hasRole("ADMIN")
            .antMatchers(HttpMethod.DELETE, "/books/delete").hasRole("ADMIN")
            .antMatchers(HttpMethod.GET, "/users/all").hasRole("ADMIN")
            .antMatchers(HttpMethod.GET, "/users/user/**").hasAnyRole("USER", "ADMIN")
            .antMatchers(HttpMethod.GET, "/books/user/**").hasAnyRole("USER", "ADMIN")
            .antMatchers(HttpMethod.GET, "/books/book/**").hasAnyRole("USER", "ADMIN")
            .antMatchers(HttpMethod.POST, "/books/book/search").hasAnyRole("USER", "ADMIN")
            .antMatchers(HttpMethod.GET, "/book/status/*").hasAnyRole("USER", "ADMIN")
            .antMatchers(HttpMethod.GET, "/books/all").hasAnyRole("USER", "ADMIN")
            .antMatchers(HttpMethod.POST, "/users/user/search").hasRole("ADMIN")
            .antMatchers(HttpMethod.POST, "/user/takeBook").hasAnyRole("USER", "ADMIN")
            .antMatchers(HttpMethod.POST, "/books/add").hasRole("ADMIN")
            .antMatchers(HttpMethod.POST, "/books/update").hasRole("ADMIN").and().csrf().disable();
}

From source file:com.arya.latihan.config.SecurityConfiguration.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    http.httpBasic().and().authorizeRequests().antMatchers("/").permitAll().antMatchers("/bower_components/**")
            .permitAll().antMatchers("/app/**/*.js").permitAll().antMatchers("/app/**/login.html").permitAll()
            .anyRequest().authenticated().and().csrf().disable();
    //        .and()
    //            .addFilterAfter(csrfHeaderFilter(), CsrfFilter.class)
    //            .csrf().csrfTokenRepository(csrfTokenRepository());

}