Override application::main in your base app. Everything goes throu it
בתאריך 10 ביול 2014 13:45, "Abhishek Kaushik" <abh...@gm...> כתב:
> Hi,
>
> I am working on an application and have a very simple requirement.
>
> Its just that I want all the requests being made to the server should pass
> an authentication criteria.
>
> If the requests are valid (based on session checks), let them continue or
> else redirect them to a login page.
>
> I have created one such implementation as shown here:
>
> void main_controller::manage_default(std::string page) {
> if(page == "/login") {
> if(session().is_set("username")) {
> response().status(cppcms::http::response::found,url(""));
> }
> } else {
> if(!session().is_set("username")) {
> response().status(cppcms::http::response::found,url("/login"));
> }
> }
> }
>
> but this function (manage_default) is mapped to default url (i.e. ""). So
> it
> won't be called if user calls some other pages like /view_bills (without
> touching the base url).
>
> So is there a way where I can capture all such requests at a single place
> and then allow such requests to continue further?
>
> Regards,
> Abhishek
>
>
>
> ------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft
> _______________________________________________
> Cppcms-users mailing list
> Cpp...@li...
> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>
|