Created
May 24, 2019 17:53
-
-
Save chathurangat/824a167985acb4118e4005c89e783afe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.RestController; | |
import javax.annotation.security.RolesAllowed; | |
@RestController | |
public class WelcomeController { | |
@GetMapping("/public") | |
public String welcomePublic() { | |
return "welcome public/guest user"; | |
} | |
@RolesAllowed({"ROLE_ADMIN"}) | |
@GetMapping("/admin") | |
public String welcomeAdmin() { | |
return "welcome admin"; | |
} | |
@RolesAllowed({"ROLE_USER"}) | |
@GetMapping("/user") | |
public String welcomeUser() { | |
return "welcome user"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment