Applet: connect to other host - java

Hallo,
Now, in my one site applet loads from A host and it should work with
B host. But When I tried to do it I got
java.security.AccessControlException: access denied (java.net.SocketPermission MY_URL:443 connect,resolve)
exception. Applet is signed. I have added crossdomain.xml to B host too, but it is not help.
Are there any solution of this issue?
crossdomain.xml:
<?xml version="1.0"?>
<!-- http://192.168.0.199/crossdomain.xml -->
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*"/>
<allow-http-request-headers-from domain="*" headers="Authorization,X-HTTP-Method-Override"/>
</cross-domain-policy>

I dont think there is a solution. An applet is allowed to contact only the server that it has been downloaded from. Regards, - M.S.

Related

Android 9: Cleartext HTTP traffic not permitted although having cleartextTrafficPermitted="true"

I have a strange issue. My app is using http to connect to a server. It works fine in many devices. However, in Xiaomi devices which has Android 9, it gives me this error:
Caused by java.io.IOException: Cleartext HTTP traffic to internet.vodafone.com.eg not permitted
at com.android.okhttp.HttpHandler$CleartextURLFilter.checkURLPermitted(HttpHandler.java:142)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:469)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:418)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:549)
at com.google.firebase.perf.network.zzd.getResponseCode(zzd.java:81)
at com.google.firebase.perf.network.zzb.getResponseCode(zzb.java:14)
at com.android.volley.toolbox.HurlStack.executeRequest(HurlStack.java:96)
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:123)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:131)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:111)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:90)
In the AndroidManifest.xml I have this:
<application
...
android:networkSecurityConfig="#xml/network_security_config"
...
</application>
My network_security_config.xml file:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">thebondnews.com</domain>
</domain-config>
</network-security-config>
Also, I have all the permission to connect to the internet. It works fine in Many devices with android 9 Like Samsung galaxy s9/s9+ and Samsung galaxy s8/s8+ and many others.
The error message was copied from Firebase Crashlatics. What is strange is that my server domain is thebondnews.com but in the log, it says internet.vodafone.com.eg or sometimes notification.etisalat.com.eg and 10.10.10.1. It is like there is kinda redirection in their devices.
Can anyone help me how to solve it? or what shall I do?
Update 1:
Could it be that I am only allowing my domain in network_security_config.xml
and because of the redirection caused by their providers the connection fails?
As Md. Asaduzzaman said in the comments.
The internet package of that user has finished and the operator tries to redirect him to the internet package page.
So it was not an issue with the app. However, some users have a limited internet package with limited access to things like Facebook, WhatsApp, Instagram..etc.
Thus, when my app tries to connect to the server, it is being redirected by the internet provider to block the traffic.

How to access java web application with IP address (without doing host entry)

I have deployed an java web application using apache-tomcat-7.0.5 on particular server. Server ip is for example 192.168.0.145.
Below is the host entry I have done in server.xml in the tomcat's conf directory.
> <Host name="license.med.com" debug="0" appBase="" unpackWARs="false"
> autoDeploy="false">
> <Context path="" docBase="/data/LicenseData/setup/licenseGen/WebContent/" debug="0"
> reloadable="true" crossContext="false" />
> </Host>
After starting tomcat server when I try to access web app with URL http://192.168.0.145:10880/, it shows me home page of tomcat.
After doing below host entry in hosts file :
192.168.0.145 license.med.com
when I try to access web app with URL - http://license.med.com:10880/, it shows me home page of the application.
But I would like to access the application using Ip address only. I have tried many things but not able to access the same.
If I host the same using eclipse from my local machine, I am able to access it using IP address. But same is not possible for the server where I have deployed my application.
Please help and Thanks in advance for your suggestions.
Thanks
After going lots of trail and error as per the suggestions provided here and on other I finally found below solution :
I have added tag with the I on through I want to access the Site.
Below is the tag I have added :
<Alias>192.168.0.145</Alias>
Now I can access it with below URL :
http://192.168.0.145:10880/
Thanks all for your responses!!!

Duplicate session error when perform proxy lookup

We have deployed a flex application on Tomcat and it uses Blaze-DS to communicate with the Java side. However when using the deployed application we constantly get the error:
Detected duplicate HTTP-based FlexSessions, generally due to the remote host disabling session cookies. Session cookies must be enabled to manage the client connection correctly. url:
'http://XX.XX.XXX.XXX:80/CB3/SdmxSandbox/messagebroker/amf;jsessionid=2A71A4A58872C757B9064D20C9E876D9''
I don't understand what is causing this or what this error really means? Can anyone help?
Further detail:
Within our Apache httpd.conf we have set up a proxy lookup so that rather than using particular ports (e.g 8082) we want to use port 80 (some of our customers operate in a locked-down environment). So the httpd.conf file looks like:
ProxyPass /CB3/ http://XX.XX.XXX.XXX:8082/
ProxyPassReverse /CB3/ http://XX.XX.XXX.XXX:8082/
Now we didn't get the Duplicate Session issue until we introduced the proxy redirect. My services-config is fairly straightforward:
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<factories>
<factory id="spring" class="flex.messaging.factory.SpringFactory" />
</factories>
<services>
<service-include file-path="remoting-config.xml" />
<default-channels>
<channel ref="my-amf" />
</default-channels>
</services>
<channels>
<channel-definition id="my-amf"
class="mx.messaging.channels.AMFChannel">
<endpoint
url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
class="flex.messaging.endpoints.AMFEndpoint" />
</channel-definition>
</channels>
Any help greatly appreciated.
Thanks,
Phil
The duplicate session message is a known problem, and it can appear from several reasons. I'm not able to tell you what is the reason in your case, but I'll wrote down the best articles dealing with this issue.
http://www.alexglosband.com/?p=3
http://meteatamel.wordpress.com/2011/01/26/duplicate-session-errors-in-lcdsblazeds/
http://blogs.adobe.com/lin/2011/05/duplication-session-error.html

Having Trouble Getting RMI Security Policy Working

I'm having trouble getting RMI security policies working. I have a .policy file on both the server and client, each of which is running a SecurityManager.
When I try and run the client its failing. My policy file grants everything atm. Heres the content:
grant { permission java.security.AllPermission };
I have the file client.policy in the root directory of my JAR file (I tried running it with the policy file outside the jar too). Then I run the client with this:
java -jar PagePlanner.jar -Djava.security.policy=client.policy -Djava.rmi.codebase=http://192.168.0.88:2077/home/me/NetbeansProjects/PageServer/dist/PageServer.jar -Djava.security.debug=access
Specifying my policy file and the path to my code base. I'm not sure if either of these are correct. I also tried setting the debug switch as I read somewhere it should give me extra info about whats going wrong, but it does not seem to make a difference.Heres the output when I run the client:
Exception in thread "main" java.security.AccessControlException: access denied (java.awt.AWTPermission setWindowAlwaysOnTop)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.awt.Window.setAlwaysOnTop(Window.java:2038)
at gui.LoginForm.<init>(LoginForm.java:59)
at main.Main.main(Main.java:21)
From which point the client just hangs. Any ideas what I'm doing wrong here? The policy setup on the server-side is pretty much the same. I can post the details if that helps.
Cheers.
Run the client with -Djava.security.debug=access,failure. Most probably your .policy file isn't being found.
BTW you don't need to set the codebase at the client unless the client has its own implementations of abstract classes/interfaces and the server doesn't know about them. The codebase is normally only set at the server, so as to annotate classes that are downloaded to the client and the Registry.

Access control Exception

When I am running RMI Server in netbeans I am getting java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
What to do?
You need to set the permissions within a policy file. An example can be found at the RMI tutorial site and also further information concering policy files.

Categories

Resources