Skip to content

Instantly share code, notes, and snippets.

@chathurangat
Created May 24, 2019 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chathurangat/824a167985acb4118e4005c89e783afe to your computer and use it in GitHub Desktop.
Save chathurangat/824a167985acb4118e4005c89e783afe to your computer and use it in GitHub Desktop.
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