package com.logicify.d2g.web.controllers;

import org.springframework.context.annotation.Configuration;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * Created by jadencorr on 06.03.17.
 */

@RestController
@EnableWebSecurity
public class SecurityController {

    @RequestMapping("/user")
    public Principal user(Principal user) {
        return user;
    }


    @Configuration
    protected static class SecurityConfiguration extends WebSecurityConfigurerAdapter {
        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http
                    .authorizeRequests()
                    .antMatchers("/login", "/").permitAll()
                    .anyRequest().authenticated().and()
                    .httpBasic()
                    .and()
                    .csrf().disable()
            ;

        }
    }


}
@@ -422,85 +422,9 @@
 ion.
-RequestMapping;%0Aimport org.springframework.web.bind.annotation.RestController
+*
 ;%0A%0Ai
@@ -595,16 +595,133 @@
 ing(
-%22/user%22)
+path = %22/user/login%22, method = RequestMethod.GET) // TODO: change this method, my change only for deploying%0A    @ResponseBody
 %0A   

change for only for correctly deploying. Must be change quickly