HelloController

PHOTO EMBED

Wed Feb 01 2023 03:27:55 GMT+0000 (Coordinated Universal Time)

Saved by @namnt

package Viettel.authen.controller;

import org.springframework.context.annotation.Role;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@PreAuthorize("hasRole('ROLE_USER')")
public class HelloController {

    @RequestMapping({ "/hello" })
    public String firstPage() {
        return "Hello World";
    }
}
content_copyCOPY