【问题标题】:Flash SecurityDomain, P2P settings and multiply swfsFlash SecurityDomain、P2P 设置和多路 swfs
【发布时间】:2012-04-03 20:52:03
【问题描述】:

我有两个 swf:

  1. 应用程序 swf
  2. 允许使用 rtmfp 复制加载数据的 p2p 客户端 swf 技术(通过 cirrus 服务)

主要思想是在某个域上拥有一个 p2p 加载器,它能够在 p2p 网络中工作,而无需多次请求每个域的权限,例如:

p2p客户端按请求加载二进制数据,我相信内容真的无所谓。

所以,我使用以下类 (app.swf) 加载 p2pclient swf

public class ClientLoader {

    // .. some code

    public function load(cb:Function, err:Function):void
    {
        _cb = cb;
        _err = err;

        var loader:Loader = new Loader();
        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, _onLoaded);
        loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, _onIoError);
        loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, _onSecurityError);
        // note that context has neither application domain nor security domain
        loader.load(new URLRequest(_url), new LoaderContext());
    }

    private function _onLoaded(e:Event):void
    {
        trace("Loaded. Connecting to the p2p network...");

        _client = e.target.content;
        _client.addEventListener(Event.CONNECT, _onClientReady);
        _client.connect();
    }

    private function _onClientReady(e:Event):void
    {
        _cb(_client);
    }

}
}

p2pclient 本身(p2pcli.swf):

public class P2P extends Sprite
{
    public function SqP2P() {
        Security.allowDomain("*");
    }

    public function connect():void
    {
        _connection = new NetConnection();
        _connection.addEventListener(NetStatusEvent.NET_STATUS, _netStatus);
        _connection.connect(CIRRUS_ADDRESS, CIRRUS_KEY);

        // after successful connect this method called
        _loadGroup();
    }

    private method _loadGroup():void
    {
        var spec:GroupSpecifier = new GroupSpecifier(_name);
        spec.serverChannelEnabled = true;
        spec.objectReplicationEnabled = true;

        _group = new NetGroup(connection, spec.groupspecWithAuthorizations());
        _group.addEventListener(NetStatusEvent.NET_STATUS, _netStatus);
    }

    private function _netStatus(event:NetStatusEvent):void
    {
        trace("NetStatusEvent:", event.info.code);
    }

}

但 Flash Player 似乎忽略了安全会话并尝试保存 app.swf 所属域的弹出设置,但不保存 p2pcli.swf 域。为什么?!

我有完全相同的代码,但是 p2pcli.swf 被替换为 swf,它将数据存储在本地共享对象中,并且所有 domain1-2-N.com 都可以访问它。

有什么想法吗?

我知道,我的英语很烂:(

【问题讨论】:

    标签: actionscript-3 rtmfp adobe-cirrus


    【解决方案1】:

    我真的不完全确定,但我会把我的答案放在那里以防万一。

    基于此类安全消息的一般用途,我不完全确定您能否阻止该对话框显示。在某些情况下,我确信对等辅助网络对某些人来说可能是一个安全风险(无论如何,它正在使用他们的带宽。)打开和关闭该通知的设置是用户端的,在 Flash 设置对话框中( Windows 7 中的控制面板...),因此暗示它天生就硬连线到 Flash 平台中。

    当然,由于我更像是 Adob​​e AIR 专家,所以我可能完全错了……为了您的项目,我真诚地希望我是!

    而且,为了记录,你的英语几乎是完美的。为了清楚起见,我调整了一段,但除此之外,就当场。 :D

    【讨论】:

    • 感谢您的回复!好吧,这是有道理的,尽管本地共享对象对用户也有潜在的危险。并且可以让某个域上的 swf “代理”来自任何其他域的一个 LSO 请求(不会弹出这个烦人的设置框)。
    • 如果我的回答有帮助,请不要忘记奖励赏金!否则,你只会输掉 50 分,而不会发生任何事情。
    • (至少接受一个答案,我的,你的,或者如果你需要的话,这样可以放弃未回答的......)
    猜你喜欢
    • 2023-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    相关资源
    最近更新 更多