Securing custom rest endpoint

I have added custom rest endpoint to keycloak by implementing provider,

now, the endpoint is open and not secured which anyone access.
Whats the way the rest endpoint can be secured like with only admin credentials.


under the spi-resource example on my repo you can find a couple of ways to do this. Hope this helps you further.