package sk.tuke.cloud.security;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;

/**
 * @author Dominik Matta
 */
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
    private final PublicKeyProvider publicKeyProvider;

    @Autowired
    public SecurityConfiguration(PublicKeyProvider publicKeyProvider) {
        this.publicKeyProvider = publicKeyProvider;
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .sessionManagement()
                .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                .and()
                .authorizeRequests()
                .anyRequest().authenticated()
                .and()
                .apply(new JWTConfigurer(publicKeyProvider));
    }
}

@@ -1097,16 +1097,42 @@
 ption %7B%0A
+        // @formatter:off%0A
         
@@ -1136,16 +1136,16 @@
    http%0A
-
         
@@ -1245,24 +1245,16 @@
 TELESS)%0A
-        
         
@@ -1252,32 +1252,32 @@
 %0A        .and()%0A
+
                 
@@ -1339,32 +1339,24 @@
 enticated()%0A
-        
         .and
@@ -1420,16 +1420,41 @@
 ider));%0A
+        // @formatter:on%0A
     %7D%0A%7D%0A

Disable code formatting in security configuration region