Secure SPA Sites

That would be ideal, Niall. I am just not sure how to go about doing that. Interesting concept.

Via Action Scheduler? Just have it run the action @Teodor recommended would be my first guess.

Well, you can check every X minutes by loading the server action via action scheduler.
In your server action add a condition step, which returns the session value.
In the then step add response code 200.
In the else step add response code 401.

On the clientside run the action with the scheduler.

In the server action component > dynamic events on unauthorized (i.e. code 401) run the redirect.

2 Likes

I’m just looking into doing something like this myself and am wondering what’s the best approach to take?

My app is setup as a SPA, I’ve an index, login and register page etc. (which are all SPA).
When a user logs in I want to redirect them to a secure SPA page. Since the Security Provider Enforcer is done at the main page level, I’m guessing that I will need two main Routes; one for the public pages (which will have Page Routes) and another for the “admin” only portion of my app (which will then also have its own Page Routes) but will also contain the Security Provider Enforcer.

Is this the correct approach to take?

Thanks in advance.

@niall_obrien,

That is what I did. I have the public SPA with a user dashboard conditioned on their login and then I have a separate admin SPA conditioned on the Security Provider Enforcer.

1 Like

Thanks for clarifying @scott - just tried it out and have it all working great. :slight_smile:

1 Like

Hi George,
Since security enforcer does not work on .html is it right to make the main /index.php? and can subsequent - content pages also be .php?
Thanks

Sure if you site gets loaded from a web server that runs PHP, you can rename it to .php

1 Like