Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.