Google Apps Marketplace - Google App Engine Java 应用程序的 SSO

发布于 2024-10-07 09:19:43 字数 1711 浏览 2 评论 0原文

当单击 Google Apps 帐户中 Google 通用导航栏的“更多”部分中的 navLink 时,我不会直接登录到我的应用程序,而是显示我的应用程序的登录页面。

我的应用程序市场清单:

<ApplicationManifest xmlns="http://schemas.google.com/ApplicationManifest/2009">
  <Name>App Name</Name>
  <Description>App Description</Description>

  <!-- Administrators and users will be sent to this URL for application support -->
  <Support>
    <Link rel="support" href="http://myappid.appspot.com/help.html" />
  </Support>

  <!-- Show this link in Google's universal navigation for all users -->
  <Extension id="navLink" type="link">
    <Name>Myapp Navlink Name</Name>
    <Url>http://myappid.appspot.com/ms.jsp?hd=${DOMAIN_NAME}</Url>
  </Extension>

  <!-- Declare our OpenID realm so our app is white listed -->
  <Extension id="realm" type="openIdRealm">
    <Url>http://myappid.appspot.com/</Url>
  </Extension>

</ApplicationManifest>

我的 web.xml 相关部分:

 <servlet>
     <servlet-name>loginJsp</servlet-name>
     <jsp-file>/login.jsp</jsp-file>
 </servlet>

 <servlet-mapping>
     <servlet-name>loginJsp</servlet-name>
     <url-pattern>/_ah/login_required</url-pattern>
 </servlet-mapping>

 <security-constraint>
  <web-resource-collection>
   <web-resource-name>ms</web-resource-name>
   <url-pattern>/ms.jsp</url-pattern>
  </web-resource-collection>
  <auth-constraint>
   <role-name>*</role-name>
  </auth-constraint>
 </security-constraint>

I don't directly get logged into my app when my navLink in "More" section of Google's universal navigation bar in a Google Apps account is clicked, instead the login page of my application is shown.

My apps marketplace manifest:

<ApplicationManifest xmlns="http://schemas.google.com/ApplicationManifest/2009">
  <Name>App Name</Name>
  <Description>App Description</Description>

  <!-- Administrators and users will be sent to this URL for application support -->
  <Support>
    <Link rel="support" href="http://myappid.appspot.com/help.html" />
  </Support>

  <!-- Show this link in Google's universal navigation for all users -->
  <Extension id="navLink" type="link">
    <Name>Myapp Navlink Name</Name>
    <Url>http://myappid.appspot.com/ms.jsp?hd=${DOMAIN_NAME}</Url>
  </Extension>

  <!-- Declare our OpenID realm so our app is white listed -->
  <Extension id="realm" type="openIdRealm">
    <Url>http://myappid.appspot.com/</Url>
  </Extension>

</ApplicationManifest>

My web.xml relevant part:

 <servlet>
     <servlet-name>loginJsp</servlet-name>
     <jsp-file>/login.jsp</jsp-file>
 </servlet>

 <servlet-mapping>
     <servlet-name>loginJsp</servlet-name>
     <url-pattern>/_ah/login_required</url-pattern>
 </servlet-mapping>

 <security-constraint>
  <web-resource-collection>
   <web-resource-name>ms</web-resource-name>
   <url-pattern>/ms.jsp</url-pattern>
  </web-resource-collection>
  <auth-constraint>
   <role-name>*</role-name>
  </auth-constraint>
 </security-constraint>

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

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

发布评论

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

评论(2

孤凫 2024-10-14 09:19:43

您需要创建一个 Servlet 来处理 http://myappid.appspot.com/ms.jsp?hd=${DOMAIN_NAME}。它将获取域名并使用该域作为 federatedIdentity 重定向到登录 URL。请参阅:

http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/ api/users/UserService.html#createLoginURL%28java.lang.String,%20java.lang.String,%20java.lang.String,%20java.util.Set%29

使用正确的federatedIdentity< /code> 设置后,用户将自动从 Google Apps 登录。

You need to create a servlet to handle http://myappid.appspot.com/ms.jsp?hd=${DOMAIN_NAME}. It will get the domain name and redirect to a login url using the domain as federatedIdentity. See :

http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/users/UserService.html#createLoginURL%28java.lang.String,%20java.lang.String,%20java.lang.String,%20java.util.Set%29

With the proper federatedIdentity set, the user will login automatically from Google Apps.

兮颜 2024-10-14 09:19:43

还。您应该将其添加到您的 application-manifest.xml 中:

<Edition id="free">
    <Name>Myapp Navlink Name</Name>
    <Extension ref="navLink" />
    <Extension ref="realm" />
</Edition>

Also. You should add this to your application-manifest.xml:

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