How to add spring boot controller to CAS7.0?

44 views
Skip to first unread message

Thomas Tong

unread,
Jan 29, 2023, 1:41:34 AM1/29/23
to CAS Community
Hi, Everyone
      I'm a new developer to CAS. I defined a spring boot controller as below.
@Slf4j
@RestController
@RequestMapping("/testcontroller")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "/name", method = RequestMethod.GET)
    public String getName()
    {
        return "TestName";
     }
}

I can get "TestName" in CAS6.6. But I got the message "You do not have permission to view this page." after I access http://localhost:8080/cas/testcontroller/name.  Would you like to let know how to exclude /testcontroller from cas validation in CAS7.0? Thank you very much.

Thomas Tong

unread,
Jan 29, 2023, 4:11:43 AM1/29/23
to CAS Community, Thomas Tong
Finally, I see the log "2023-01-29 15:00:47,966 DEBUG [org.apereo.cas.web.security.CasWebSecurityConfigurerAdapter] - <Configuring protocol endpoints [[/login**, /login/**, /logout**, /logout/**, /validate**, /validate/**, /serviceValidate**, /serviceValidate/**, /p3/serviceValidate**, /p3/serviceValidate/**, /proxyValidate**, /proxyValidate/**, /p3/proxyValidate**, /p3/proxyValidate/**, /proxy**, /proxy/**, /oauth2.0**, /oauth2.0/**, /v1**, /v1/**, /webjars/**, /themes/**, /js/**, /css/**, /images/**, /static/**, /error, /favicon.ico]] to exclude/ignore from http security>". Spring security filter this endpoint. It return to normal after I change testcontroller to login. 
Reply all
Reply to author
Forward
0 new messages