The scenario:
- An enterprise, behind-the-firewall Python web application.
- Kerberos should be used to authenticate the users.
- I have working code that sends the correct responses from the server (the
Negotiate
header etc.) and get the Windows user name of the user accessing the application, using thekerberos-sspi
package
I have little experience with Kerberos, but some experience with web applications.
In other Python web apps I have created that use a built-in user database, the authentication flow is typically as follows:
- For each request, check if the request has a (signed) cookie containing the user id (or some variation - for instance using flask-login where the user id is stored in
flask.session
) - If the cookie exists, respond normally.
- If the no such cookie exists, redirect to
/login/
displaying a username/password form.POST
to/login/
verifies correct username/password, sets the secure cookie and redirects to the URL specified in the?next=
query param.
My question is:
- In the Kerberos-authenticated web app, is the authentication flow similar?
I.e. should I do the following:
- For each request, check if the request has a (signed) cookie containing the user id
- If the cookie exists, respond normally.
- If the no such cookie exists, redirect to
/login/
./login/
does the necessary stuff to figure out who the user is (i.e. sending theNegotiate
header, usekerberos_sspi
to find the user name etc.), then set the secure cookie and redirect to the URL specified in the?next=
query param.
Or should it be handled some other way?