Problem with authentication services

27 views
Skip to first unread message

Dario

unread,
Sep 2, 2009, 2:23:52 PM9/2/09
to Google App Engine
Hi all,
I created a Java application on Google App Engine using authentication
services.

I tested both using hard coding and using the web.xml file approaches.
First I configured an App Engine application to "allow anyone with a
Google Account" and authentication did work. But when I configured an
App Engine application as "restrict to a Google Apps Account" then
authentication did not work, giving always a 500 error.

Someone can help me?

Thanks
Dario

Brandon N. Wirtz

unread,
Sep 2, 2009, 5:47:51 PM9/2/09
to google-a...@googlegroups.com
Silly question, you were logged in to one of the Google Apps Accounts you
specified in the Config?

Did you check the error log in the dash board? That would be helpful
information to have in trouble shooting your issue.

-Brandon Wirtz

Dario

unread,
Sep 3, 2009, 5:37:04 AM9/3/09
to Google App Engine
Yes, I was logged with one of the google apps accounts for the domain
defined in the config.
I've attached both the LOG and the part of the code that sent the
exception.

You can see that the row that throws the exception is row 87,
corresponding to the following code: "userService.createLoginURL
(thisURL)". The contents of "thisURL" is the url "/LoginServlet"
mapped back to the same servlet.

I tested the appplication both logged and not logged in, and
inexplicably the error is always at row 87. It seems that the
statement "request.getUserPrincipal()" always returns null. Maybe
there are two problems here ...
thanks
Dario

***LOG***
google.LoginServlet doGet: The requested URL was not allowed: /
LoginServlet
java.lang.IllegalArgumentException: The requested URL was not
allowed: /LoginServlet
at com.google.appengine.api.users.UserServiceImpl.doCreateURL
(UserServiceImpl.java:66)
at com.google.appengine.api.users.UserServiceImpl.createLoginURL
(UserServiceImpl.java:22)
at google.LoginServlet.doGet(LoginServlet.java:87)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1093)
at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter
(SaveSessionFilter.java:35)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle
(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle
(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle
(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle
(ContextHandler.java:712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
405)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle
(AppVersionHandlerMap.java:237)
at org.mortbay.jetty.handler.HandlerWrapper.handle
(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:313)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
506)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
(HttpConnection.java:830)
at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable
(RpcRequestParser.java:76)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
at
com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest
(JettyServletEngineAdapter.java:139)
at com.google.apphosting.runtime.JavaRuntime.handleRequest
(JavaRuntime.java:235)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:4823)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:4821)
at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest
(BlockingApplicationHandler.java:24)
at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:
359)
at com.google.net.rpc.impl.Server$2.run(Server.java:820)
at com.google.tracing.LocalTraceSpanRunnable.run
(LocalTraceSpanRunnable.java:56)
at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan
(LocalTraceSpanBuilder.java:516)
at com.google.net.rpc.impl.Server.startRpc(Server.java:775)
at com.google.net.rpc.impl.Server.processRequest(Server.java:348)
at com.google.net.rpc.impl.ServerConnection.messageReceived
(ServerConnection.java:436)
at com.google.net.rpc.impl.RpcConnection.parseMessages
(RpcConnection.java:319)
at com.google.net.rpc.impl.RpcConnection.dataReceived
(RpcConnection.java:290)
at com.google.net.async.Connection.handleReadEvent(Connection.java:
428)
at com.google.net.async.EventDispatcher.processNetworkEvents
(EventDispatcher.java:762)
at com.google.net.async.EventDispatcher.internalLoop
(EventDispatcher.java:207)
at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:
101)
at com.google.net.rpc.RpcService.runUntilServerShutdown
(RpcService.java:251)
at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run
(JavaRuntime.java:374)
at java.lang.Thread.run(Unknown Source)

***CODE***
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException
{

UserService userService = UserServiceFactory.getUserService();

String thisURL = request.getRequestURI();

try {

if (request.getUserPrincipal() != null) {
response.getWriter().println(
"<p>Hello, " + request.getUserPrincipal().getName()
+ "! You can <a href=\""
+ userService.createLogoutURL(thisURL)
+ "\">sign out</a>.</p>");

Login login = new Login();
//AppsForYourDomainClient client = login.run("test", "pwd",
"acme.com");
//request.getSession().setAttribute("client", client);
// processRequest(request, response);
// response.sendRedirect("/lista.jsp");
RequestDispatcher dispatcher = getServletContext()
.getRequestDispatcher("/home.jsp");
dispatcher.forward(request, response);
} else {
response.getWriter().println(
"<p>Please <a href=\""
+ userService.createLoginURL(thisURL)
+ "\">sign in</a>.</p>");
}
} catch (Exception e) {
log.log(Level.SEVERE, e.getMessage(), e);

Dario

unread,
Sep 3, 2009, 8:09:14 AM9/3/09
to Google App Engine
Hi,
I resolved the problem. I forgotten to active the application in the
Google Apps Dashboard :)

Thanks

Dario
Reply all
Reply to author
Forward
0 new messages