How to protect swf file from running in other domains?

2

How can I protect a swf file by Actionscript 3.0?

I know that Security.allowDomain("www.example.com") exists, but it only serves to receive data from the domain that is in parentheses, if I'm not mistaken. Does anyone know any other way for as3?

Thank you!

    
asked by anonymous 16.09.2015 / 05:13

1 answer

0

To make the SWF obsolete in other domains, you can use the SecurityDomain.currentDomain.domainID command. This feature returns a unique swf hosting domain ID through the singleton SecurityDomain . So you can check if the file is in the pre-defined domain.

if(SecurityDomain.currentDomain.domainID == "0A806C77AC090336AB036671325939AA720863AE7F89194428B0751457893451") {
      //iniciar código;
}

Another way, is to use Security.pageDomain , this method returns the String of the domain that swf is hosting.

if(Security.pageDomain == "http://www.seusiste.com.br/") {
    //iniciar código;
}

To prevent other swfs from being able to load your swf, you need to use just the code you mentioned Security.allowDomain () . Passing as a parameter the domain that is able to import your swf.

Security.allowDomain("http://www.seudominio.com.br/");
    
17.09.2015 / 15:32