gwt-appengine 应用程序,其部分内容受保护,其余内容公开

发布于 2024-12-04 21:56:57 字数 806 浏览 1 评论 0原文

我一整天都在为一个问题苦苦挣扎。我确信一定有一些简单的解决方案,很多人已经实施了,因为在我看来这是一个基本设置。

我正在使用 requestfactory 使用 GWT 和 appengine 构建一个应用程序。这个应用程序有一些每个人都应该有权访问的“页面”(它们实际上是 MVP 视图)。它就像主页和几个描述我们提供的服务的视图。然后,如果您想使用该服务,则必须登录(使用谷歌帐户等)。只有登录后,您才能访问应用程序中的其余视图(页面)。问题是,如何处理这个问题?事实上,某些页面和某些 requestfactory 调用是公开的,而其他一些页面必须可供已登录的人使用?

我已经放弃了 web.xml 中的 auth-constraints 标签,因为它们要么全部工作,要么全部不工作。

下一个替代方案是使用 servlet 过滤器(如费用演示所做的那样)。这可以工作,但前提是“开放”或未受保护的页面不需要访问 appengine 数据存储区中的任何数据(而且我不想关上那扇门,也许将来我想显示状态或数量)用户等)。这样做的原因是,使用请求工厂你只有一个 servlet,所以如果你放置一个过滤器,如果用户未登录,你就会关闭与 appengine 的所有通信。

我正在考虑实现这个过滤器,一次对所有内容进行 requesfactory用户已登录,并且还为我可能想要在“主页或信息页面”中显示的数据实现一些 RPC 服务,我可能需要从数据存储中检索这些数据。然而,这对我来说看起来有点矫枉过正。

另一种选择是实施检查,确保用户已登录我想要保护的所有请求工厂服务方法。但这看起来也不优雅......

有人遇到同样的问题吗?有什么想法吗?

我将不胜感激任何帮助。

谢谢,

I have been struggling all day with an issue. I am sure there must be some easy solution that lots have already implemented as it looks to me as a basic setup.

I am building an app with GWT and appengine using requestfactory. This app has some "pages" (they are actually MVP views) that everybody should have access to. It's like the home page and a couple of views where the service we provide is described. Then if you want to use the service you have to login (with google accounts and all that). Only being logged in you have access to the rest of the views (pages) in the app. The question is, how to handle this?, the fact that some pages and some requestfactory calls are public and some other have to be available to those that have logged in?

I have already discarded the auth-constraints tags in web.xml because they work with all or nothing.

The next alternative was to use servlet filters (as the expenses demo does). That could work, but only if the "open" or not secured pages didn't need to access any data from appengine datastore (and I don't want to close that door, maybe in the future I want to show status or number of users, etc etc). The reason for this is that with request factory you only have one servlet so if you put a filter you shut down all comunication with appengine if the user is not logged in.

I was thinking of implementing this filter, with requesfactory for all the stuff once the user is logged in and also implement some RPC services for the data i might want to display in the "home or information pages" that i might need to retrieve from the datastore. However it looks a bit overkill for me.

Another alternative is to implement a check that the user is logged in all the request factory service methods that i want to protect. But that doesn't look to elegant either...

Anyone had the same problem? any ideas?

I'd appreciate any help on this.

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我乃一代侩神 2024-12-11 21:56:57

您说身份验证约束是“全有或全无”,但事实并非如此 - 它们是针对每个网址的。有关详细信息,请参阅此处。另外,servlet 过滤器和数据存储访问的连接是不合理的 - 两者彼此无关。

You say that the auth constraints are "all or nothing", but that's not true - they're per-url. See here for details. Also, your connection of servlet filters and datastore access is a non-sequitir - the two have nothing to do with each other.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文