This is an automated email from the ASF dual-hosted git repository.

piotrz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 56f5909aae Add version of URLBinaryLoader and URLStream with enabled 
credentials (withCredentials = true)
56f5909aae is described below

commit 56f5909aaea704edb25f8281d2e387638df1a344
Author: Piotr Zarzycki <[email protected]>
AuthorDate: Thu Jan 9 17:28:28 2025 +0100

    Add version of URLBinaryLoader and URLStream with enabled credentials 
(withCredentials = true)
    
    (related to #1251)
---
 .../Network/src/main/royale/NetworkClasses.as      |  1 +
 .../net/URLBinaryLoaderWithCorsCredentials.as      | 48 ++++++++++++++++++++++
 .../royale/net/URLStreamWithCorsCredentials.as     | 47 +++++++++++++++++++++
 3 files changed, 96 insertions(+)

diff --git a/frameworks/projects/Network/src/main/royale/NetworkClasses.as 
b/frameworks/projects/Network/src/main/royale/NetworkClasses.as
index 18ef788bd5..4423c4b4d7 100644
--- a/frameworks/projects/Network/src/main/royale/NetworkClasses.as
+++ b/frameworks/projects/Network/src/main/royale/NetworkClasses.as
@@ -28,6 +28,7 @@ package
     {
         import org.apache.royale.net.URLLoader; URLLoader;
         import org.apache.royale.net.URLBinaryLoader; URLBinaryLoader;
+        import org.apache.royale.net.URLBinaryLoaderWithCorsCredentials; 
URLBinaryLoaderWithCorsCredentials;
         import org.apache.royale.net.HTTPConstants; HTTPConstants;
         import org.apache.royale.net.URLBinaryUploader; URLBinaryUploader;
         import org.apache.royale.net.URLVariables; URLVariables;
diff --git 
a/frameworks/projects/Network/src/main/royale/org/apache/royale/net/URLBinaryLoaderWithCorsCredentials.as
 
b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/URLBinaryLoaderWithCorsCredentials.as
new file mode 100644
index 0000000000..bfac69ea08
--- /dev/null
+++ 
b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/URLBinaryLoaderWithCorsCredentials.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.net
+{
+    import org.apache.royale.net.URLBinaryLoader;
+
+       /**
+        *  Provides binary data loading functionality with CORS credentials 
support
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.9.12
+        *
+        *  @royalesuppresspublicvarwarning
+        */
+       public class URLBinaryLoaderWithCorsCredentials extends URLBinaryLoader 
+       {
+               /**
+                * constructor
+                */
+               public function URLBinaryLoaderWithCorsCredentials()
+               {
+                       super();
+               }
+               
+               override protected function createStream():void
+               {
+                       this.stream = new URLStreamWithCorsCredentials();
+               }
+       }
+}
\ No newline at end of file
diff --git 
a/frameworks/projects/Network/src/main/royale/org/apache/royale/net/URLStreamWithCorsCredentials.as
 
b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/URLStreamWithCorsCredentials.as
new file mode 100644
index 0000000000..d72722d65e
--- /dev/null
+++ 
b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/URLStreamWithCorsCredentials.as
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.net
+{
+    import org.apache.royale.net.URLStream;
+
+       /**
+        *  Provides URL streaming functionality with CORS credentials enabled 
(withCredentials = true)
+        *
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.9.12
+        *
+        *  @royalesuppresspublicvarwarning
+        */
+       public class URLStreamWithCorsCredentials extends URLStream 
+       {
+               public function URLStreamWithCorsCredentials()
+               {
+                       super();
+               }
+               
+               override protected function createXmlHttpRequest():void
+               {
+                       super.createXmlHttpRequest();
+                       
+                       xhr.withCredentials = true;
+               }
+       }
+}
\ No newline at end of file

Reply via email to