Project

General

Profile

How to respond with a WWW-Authenticate header

Added by Bart Luyckx almost 2 years ago

I want to make a Wt application that runs on a linux machine and which uses GSS-API to authenticate a Windows user.
(The users' credentials are stored in an Active Directory installed on a Windows server)

After the browser reaches my Wt application (any URL) for the first time I want to send it a 'WWW-Authenticate' response header, but I'm completely lost
on out how to set this up in Wt...

`MyApp::MyApp(const Wt::WEnvironment& env) : Wt::WApplication(env)
{
setTitle("My application");

    // 1) construct a Wt::Http::Message::Header and populate it with 'WWW-Authenticate'
    // 

    // 2) Add the header to a Wt::Http::Response and send the response back to the browser
    // 

}
`
Do I need to create a Wt::WResource class first that represents the application's requested resource (pretty much any resource within MyApp) and
implement a handleRequest(...) to be able to grab the browser's Wt::Http::Request and send it a follow-up Wt::Http::Response ??

Any guidance would be so much appreciated,
Bart