Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google app engine restrict access to a set of google accounts

It's very easy to get authentication running on app engine for google accounts. I'm looking for the simplest way to only allow a specific set of accounts access to the page, more generally the resources (servlets, static files, etc). I would be perfectly happy with a hardcoded list of email names in web.xml. Or something similar in the java code. Flexility is not the priority. The context is a GWT+GAE application that only 3 users ever should have access to.

Thanks, Matyas

like image 282
Matyas Avatar asked Nov 04 '22 19:11

Matyas


1 Answers

pseudo code might look like this for your login_required decorator.

def myuser_login_required(f):
    def wrap(request, *args, **kwargs):
            if not (user and user in ["allowedemail","andallowedemail"]):
                 return redirect()
            return f(request, *args, **kwargs)
    wrap.__doc__=f.__doc__
    wrap.__name__=f.__name__
    return wrap
like image 197
iamgopal Avatar answered Nov 11 '22 02:11

iamgopal