简体   繁体   中英

Java desktop application connect to GAE

i'm trying to connect a desktop application in java to google app engine using the javax servlet. But I'm not sure what to do.

the webserver manager for login is like this

 public class UserServicesP3Servlet extends HttpServlet 
{
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException 
{       
    doGet(req,resp);
}

and in a browser i connect using

else if(address.indexOf("/dinamicas/login")!=-1)
    {
            StringMaisAutenticado sma = Autenticacao.login(req,resp,param1,param2);
            resposta = sma.string;
            utilizadorAutenticado = sma.utilizadorAutent;
    }

I'm not really sure what to do in the desktop to login. Can someone point me in the right direction?

Thank you for your time.

You can tune up your app's authentication options in three ways :

  1. using google accounts
  2. users of google apps
  3. using OpenID

Applying to your situation, you can authenticate users like

UserService userService = UserServiceFactory.getUserService(); 
User user = userService.getCurrentUser(); 
if (user == null) 
    response.sendRedirect("/index.jsp"); 

Next you can authorize access to their data using AuthSub or OAuth .

I hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM