Exemplo n.º 1
0
def UpgradeAndStoreToken(client,email,service,token):
    client.SetAuthSubToken(token)
    client.UpgradeToSessionToken()
  
    stored_token = AuthSubStoredToken.gql('WHERE user_email = :1 and target_service = :2',
        email, service).get()
    if stored_token:
        stored_token.session_token = token
        stored_token.put()
    else:
        new_token = AuthSubStoredToken(user_email=email,
            session_token=client.GetAuthSubToken(),
            target_service=service)
        new_token.put()
    return client.GetAuthSubToken()
Exemplo n.º 2
0
def LookupToken(email, service):
    stored_token = AuthSubStoredToken.gql('WHERE user_email = :1 and target_service = :2',
        email, service).get()
    if stored_token:
        return stored_token.session_token
    else:
        return None
Exemplo n.º 3
0
 def DeleteSessionToken(self,user_email,target_service):
     stored_token = AuthSubStoredToken.gql('WHERE user_email = :1 and target_service = :2',
         user_email, target_service).get()
     if stored_token:
         stored_token.delete()
     return True
Exemplo n.º 4
0
 def get(self):
     session_tokens = AuthSubStoredToken.all()
     template_values = {"session_tokens": session_tokens}
     self.generate("admin/admin_authsub.html", template_values)
Exemplo n.º 5
0
def DeleteUnvalidToken(email, service):
    stored_token = AuthSubStoredToken.gql('WHERE user_email = :1 and target_service = :2',
        email, service).get()
    if stored_token:
        return stored_token.delete()
Exemplo n.º 6
0
 def get(self):
       session_tokens = AuthSubStoredToken.all()
       template_values = {
         'session_tokens':session_tokens,
         }
       self.generate('admin/admin_authsub.html',template_values)