Flash Security Sandbox-security domain and program domain

Source: Internet
Author: User

What is the same domain name:The Protocol is the same (HTTP and HTTPS are different), the host is the same (www.a.com and new.a.com are different), the port is the same (http://www.a.com: 80 and http://www.a.com: 8816 are different)

 

Security Domain: used to secure file access and service access under different domain names.

It is often used in the sandbox:

(1) File Access Security:

    1. JS and flash interface call: Set security. allowdomain ('*');
    2. Flash SWF loading call interface:

1) Sub-SwF trust parent SWF: Set security. allowdomain ('*');

2) parent SWF trust sub-SwF: You can set the sub-security domain in loadercontext to be the same as your own security domain.

    1. Two SWF files communicate through localconnection: security. allowdomain ('*');

(2) Service Access Security:

    1. Communication between flash and PHP backend: Cross-origin access files are configured on the server.
    2. Communication between flash and socket backend: Cross-Domain service is placed through port 843.

 

ApplicationProgramDomain: it is mainly used to solve class naming conflicts under the same security domain.The application domain only exists in the same security domain and is defined as the management class. For the loaded SWF, you can use loadercontext to specify the program domain of the sub-application during loading.

There are four applicationdomain attributes available for you to choose from:

  • Loader'sApplicationdomain.Default value. You can use the syntax new applicationdomain (applicationdomain. currentdomain) to explicitly represent this option. This will allow the loaded SWF file to directly use the parent class. For example, you can use it by writing new myclassdefinedinparent. However, the parent class cannot use this syntax. If the parent class uses a child class, it must call applicationdomain. getdefinition () to retrieve them. The advantage of this selection is that if the class defined by the child level has the same name as the class defined by the parent level, no error results will be displayed. The child level only inherits the definition of the class defined by the parent level, unless the child or parent calls applicationdomain. getdefinition () method to retrieve the child-level conflict definition. Otherwise, this definition is not used.
  • Loader's ownApplicationdomain.Use this application domain when using applicationdomain. currentdomain. After loading is complete, the parent and child can directly use the peer class. If the class to be defined by the child level has the same name as the class defined by the parent level, use the parent class and ignore the Child class.
  • SystemApplicationdomain.Use this application domain when using new applicationdomain (null. This completely isolates the loaders and The loaders, allowing them to define classes of their respective versions using the same name without conflict or hiding. The only way for one party to view the other class is to call the applicationdomain. getdefinition () method.
  • OthersApplicationdomain.Sometimes there may be more complex applicationdomain hierarchies. You can load SWF files from your own securitydomain to any applicationdomain. For example, new applicationdomain (applicationdomain. currentdomain. parentdomain. parentdomain) loads the SWF file to a new child of the parent level of the current domain.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.