gpt4 book ai didi

java - 如何使用Ant Web Start在build.xml中添加安全权限

转载 作者:搜寻专家 更新时间:2023-11-01 03:23:53 25 4
gpt4 key购买 nike

我对Ant等java构建工具不是很熟悉。我们有一个旧的 java web 启动应用程序,现在有 new security requirements for RIAs我必须在我的 build.xml 中添加一个安全标记,但我不知道该怎么做。我正在使用 ant deploy 来构建我的应用程序。而且我也在用ant-jnlp-war(我实在想不通这个ant-jnlp-war用在什么地方)我的build.xml的相关部分如下:

<target name="pack" depends="buildinfo,dist,sign">
<jw:jnlpwar
tofile="${war}/lmc.war"
title="Company Management Console"
vendor="Company Teknoloji"
codebase="dummy"
signStorepass="secret"
signAlias="labris">
<jw:description>Company Management Console</jw:description>
<jw:description kind="short">LMC</jw:description>
<jw:shortcut desktop="true" menu="true" submenu="Company Management Console"/>
<jw:j2se minVersion="1.5" args="-Xmx128M" />
<lib dir="${dist}/lib">
<include name="**/*.jar"/>
<exclude name="client.jar"/>
</lib>
<lib dir="${dist}/modules">
<include name="**/*.jar"/>
</lib>
<jw:application mainclass="com.idealteknoloji.lmc.client.ClientManager" jar="${dist}/lib/client.jar"/>
</jw:jnlpwar>
<exec executable="./make-client-packages"/>
</target>

如何以及在哪里可以将安全属性添加为沙箱。

最佳答案

让我们澄清一下......

Ant-jnlp-war只需创建 war ,它允许您将应用程序分发给客户端并包含您的 jar,这意味着您应该在调用 ant-jnlp-war 之前拥有 jar

New security requirements for RIA与 jar 相关,因为您需要在 META-INF/MANIFEST.MF 中指定可以从中分发站点应用程序:

Manifest Attributes

  1. Permissions – Introduced in 7u25, and required as of 7u51. Indicates if the RIA should run within the sandbox or require full-permissions.
  2. Codebase – Introduced in 7u25 and optional/encouraged as of 7u51. Points to the known location of the hosted code (e.g. intranet.example.com).

正如我们阐明的那样,您不需要更改 ant-jnlp-war,您只需要在您的 jar 中包含正确的 MANIFEST.MF。

这里有两种选择:

  1. 使用 Ant 任务创建 MANIFEST.MF like并配置它,example :

      <jar destfile="test.jar" basedir=".">
    <include name="build"/>
    <manifest>
    <attribute name="Permissions" value="sandbox">
    <attribute name="Codebase" value="example.com">
    </manifest>
    </jar>
  2. 手动创建 MANIFEST.MF 并将其放入 META-INF 文件夹下的 jar

    Manifest-Version: 1.0
    Created-By: 1.7.0_51
    Permissions: sandbox
    Codebase: www.java.com

关于java - 如何使用Ant Web Start在build.xml中添加安全权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20654473/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com