org.jboss.as.arquillian.container.embedded.SecurityActions Maven / Gradle / Ivy
/*
* Copyright The WildFly Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.jboss.as.arquillian.container.embedded;
import java.security.AccessController;
import java.security.PrivilegedAction;
import org.wildfly.security.manager.WildFlySecurityManager;
/**
* Security actions to access system environment information. No methods in
* this class are to be made public under any circumstances!
*
* @author Guillaume Grossetie
*/
class SecurityActions {
private SecurityActions() {
}
static void setSystemProperty(final String key, final String value) {
if (!WildFlySecurityManager.isChecking()) {
System.setProperty(key, value);
} else {
AccessController.doPrivileged(new PrivilegedAction() {
@Override
public Void run() {
System.setProperty(key, value);
return null;
}
});
}
}
}