All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.smartcosmos.extension.stormpath.config.ServiceUserAccessSecurityConfiguration Maven / Gradle / Ivy

The newest version!
package net.smartcosmos.extension.stormpath.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

import net.smartcosmos.extension.stormpath.auth.provider.ServiceUserAccessAuthenticationProvider;

@Configuration
@Order(2)
@EnableConfigurationProperties(ServiceUserProperties.class)
public class ServiceUserAccessSecurityConfiguration extends WebSecurityConfigurerAdapter {

    @Autowired
    private ServiceUserAccessAuthenticationProvider serviceUserAccessAuthenticationProvider;

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {

        auth.authenticationProvider(serviceUserAccessAuthenticationProvider);
    }

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

        http // @formatter:off
            .csrf()
                .disable()
            .authorizeRequests()
                .antMatchers("/authenticate/**").authenticated()
                .anyRequest().authenticated()
            .and()
            .httpBasic();
        // @formatter:on
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy