是否有任何方法可以在启用NetFx40_LegacySecurityPolicy的情况下执行遗留设计时代码?
更具体地说,是否有任何方法可以让DevExpress 8.2 winforms设计师在VisualStudio 2010中工作?
由于这个问题我得到了错误,并没有找到关于设计时模式的帮助,只是关于运行时:
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
</runtime>
Run Code Online (Sandbox Code Playgroud)
我该如何解决winforms设计师的问题?
我遇到了一些麻烦 - 实际上很多 - 试图弄清楚NetBeans如何为特定应用程序读取我的策略文件.请看下面的代码:
public static void main(final String[] args)
{
System.setSecurityManager(new SecurityManager());
System.setProperty("java.security.policy","file:/C:/Users/kBPersonal/Documents/NetBeansProjects/JAASTest/JAASTest.policy");
EventQueue.invokeLater(new Runnable()
{
public void run()
{
JFrame frame = new JAASFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
});
}
Run Code Online (Sandbox Code Playgroud)
无论我做什么,我都会收到以下错误,让我知道NetBeans没有读取我的security.policy文件(我甚至将它的位置添加到了主安全.policy文件中C:\Program Files (x86)\Java\jre6\lib\security\java.security).顺便说一句,第20行是我尝试设置的地方System.setProperty("java.security.policy, ...)
Exception in thread "main" java.security.AccessControlException: access denied (java.util.PropertyPermission java.security.policy write)
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.lang.System.setProperty(System.java:725)
at JAASTest.main(JAASTest.java:20)
Run Code Online (Sandbox Code Playgroud)
非常感谢任何和所有的帮助!
将 chrome 更新到版本 88.0.4324.104 后,控制台窗口出现以下错误
Error with Permissions-Policy header: Parse of permission policy failed because of errors reported by strctured header parser.
Run Code Online (Sandbox Code Playgroud)
该应用程序使用 Aurelia SPA 从 ASP.NET Core 3.1 开发。尝试将以下中间件添加到后端
app.Use(async (context, next) =>
{
context.Response.Headers.Add("Permission-Policy", "geolocation 'none';midi 'none';notifications 'none';push 'none';sync-xhr 'none';microphone 'none';camera 'none';magnetometer 'none';gyroscope 'none';speaker 'self';vibrate 'none';fullscreen 'self';payment 'none';");
await next();
});
Run Code Online (Sandbox Code Playgroud)
但仍然收到控制台错误。
我需要在非托管进程中托管.NET运行时.我有通过COM加载运行时的代码,我可以将程序集加载到AppDomain并执行代码就好了.
但是,我遇到了托管在网络共享上的应用程序的问题,并且必须更改应用程序策略才能让它们执行而不是一个选项.所以我想要做的是将运行时的主AppDomain的权限级别设置为不受限制.
有人可以举例说明如何设置AppDomain策略级别吗?我无法弄清楚如何从非托管代码实例化所需的类来创建PolicyLevel和相关对象并设置策略.基本上我不知道我需要从我使用的C++代码中使用什么包含/命名空间引用.
这是我此时的代码:
/// Starts up the CLR and creates a Default AppDomain
DWORD WINAPI ClrLoad(char *ErrorMessage, DWORD *dwErrorSize)
{
if (spDefAppDomain)
return 1;
//Retrieve a pointer to the ICorRuntimeHost interface
HRESULT hr = CorBindToRuntimeEx(
ClrVersion, //Retrieve latest version by default
L"wks", //Request a WorkStation build of the CLR
STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN | STARTUP_CONCURRENT_GC,
CLSID_CorRuntimeHost,
IID_ICorRuntimeHost,
(void**)&spRuntimeHost
);
if (FAILED(hr))
{
*dwErrorSize = SetError(hr,ErrorMessage);
return hr;
}
//Start the CLR
hr = spRuntimeHost->Start();
if (FAILED(hr))
return hr;
CComPtr<IUnknown> pUnk;
//Retrieve the …Run Code Online (Sandbox Code Playgroud) 我想在 Wildfly 服务器上部署一个 Web 应用程序 (app.war)。Web 应用程序有自己的自定义安全管理器集,不允许更改 Java 安全策略。我能够成功部署 Web 应用程序。但是访问它时,它抛出以下异常。有没有办法在不更改应用程序代码的情况下解决问题
at CustomSecurityManager.checkPermission(CustomSecurityManager.java:131)
at javax.security.jacc.PolicyContext.setContextID(PolicyContext.java:206)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler$SetContextIDAction.run(JACCContextIdHandler.java:85)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler$SetContextIDAction.run(JACCContextIdHandler.java:74)
at org.wildfly.security.manager.WildFlySecurityManager.doUnchecked(WildFlySecurityManager.java:837)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.setContextID(JACCContextIdHandler.java:92)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:65)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Run Code Online (Sandbox Code Playgroud) public class S3ButcketTest
{
public static void main(String args[])
{
System.setSecurityManager(new RMISecurityManager());
ForkJoinPool pool = new ForkJoinPool(1);
System.out.println("main: "+Policy.getPolicy());
pool.execute(new Runnable()
{
@Override
public void run()
{
try
{
Thread.sleep(1000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
System.out.println("pool: "+Policy.getPolicy());
}
});
pool.shutdown();
try
{
pool.awaitTermination(1000, TimeUnit.SECONDS);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
使用 VM 参数在两个不同的 JDK 版本(8 和 11)上运行:-Djava.security.policy=C:\test_system.policy
test_system.policy 内容:
grant {
permission java.security.AllPermission;
};
Run Code Online (Sandbox Code Playgroud)
使用JDK11运行时的输出:
main: sun.security.provider.PolicyFile@4cb2c100
Exception in thread "ForkJoinPool-1-worker-3" java.security.AccessControlException: access denied ("java.security.SecurityPermission" …Run Code Online (Sandbox Code Playgroud) java ×3
asp.net-core ×1
aurelia ×1
c# ×1
c++ ×1
clr-hosting ×1
devexpress ×1
fork-join ×1
java-11 ×1
netbeans ×1
rmi ×1
wildfly ×1