package com.jasonfelege.todo.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/hello")
public class HelloController {

	@RequestMapping("/")
	@Secured("ROLE_USER")
	public String helloWorld(Authentication auth, String token) {
		String out = "hello ";
		
		if (auth != null) {
			out += auth.getName();
		}
		
		out += " "  + token;
		
		return out;
	}
	
	@RequestMapping("/admin")
	@Secured("ROLE_ADMIN")
	public String helloAdmin(Authentication auth, String token) {
		String out = "admin ";
		
		if (auth != null) {
			out += auth.getName();
		}
		
		out += " "  + token;
		
		return out;
	}
}

@@ -35,16 +35,73 @@
 oller;%0A%0A
+import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A
 import o
@@ -155,16 +155,16 @@
 ecured;%0A
-
 import o
@@ -416,17 +416,101 @@
 oller %7B%0A
+%09private static final Logger LOG = LoggerFactory.getLogger(HelloController.class);%0A%09
 %0A
-
 %09@Reques
@@ -601,32 +601,108 @@
 String token) %7B%0A
+%09%09LOG.info(%22action=helloWorld authentication=%7B%7D token=%7B%7D%22, auth, token);%0A%09%09%0A
 %09%09String out = %22
@@ -864,16 +864,16 @@
 ADMIN%22)%0A
-
 %09public 
@@ -927,16 +927,92 @@
 oken) %7B%0A
+%09%09LOG.info(%22action=helloAdmin authentication=%7B%7D token=%7B%7D%22, auth, token);%0A%09%09%0A
 %09%09String

add simple logging to hello controller