Flask - authentication per request - where store user?

Flask - authentication per request - where store user?

Postby marcusadamski » Wed May 28, 2014 12:38 pm

Hi all,

I'm new to the Flask framework and looking to add a Kerberos authentication decorator. Within the decorator I would like to store the name of the authenticated user, so the request can make use of it. E.g.

Code: Select all
@authenticate_user
    .... authenticate
   ..... user = "USER"


@app.route("/secure")
@authenticate_user
def secure():
    print "authenticated user: {0}".format(user)


However, I don't quite understand how the scopes work in Flask - where is the best place to safely store the authenticated user name on a per request basis?

Many thanks for any help,
Marc
marcusadamski
 
Posts: 4
Joined: Fri May 31, 2013 7:09 am

Return to Web Development

Who is online

Users browsing this forum: No registered users and 1 guest