Create a flag so the custom page can be set as private (behind authentication) or public. This is a better solution than using some custom Javascript to check for a session because it will allow to return the correct HTTP code (403) and redirect automatically to the authentication page.