Example usage for java.net SocketPermission SocketPermission

List of usage examples for java.net SocketPermission SocketPermission

Introduction

In this page you can find the example usage for java.net SocketPermission SocketPermission.

Prototype

SocketPermission(String host, int mask) 

Source Link

Usage

From source file:org.jboss.as.test.integration.security.loginmodules.negotiation.SPNEGOLoginModuleTestCase.java

/**
 * Creates {@link WebArchive}./*from  w ww  . j a va2  s . c o  m*/
 *
 * @return
 */
@Deployment(name = "WEB", testable = false)
public static WebArchive deployment() {
    LOGGER.debug("Web deployment");
    final WebArchive war = createWebApp(WEBAPP_NAME, "web-spnego-authn.xml", "SPNEGO");
    war.addAsManifestResource(PermissionUtils.createPermissionsXmlAsset(
            // Permissions for PropagateIdentityServlet to get delegation credentials DelegationCredentialContext.getDelegCredential()
            new RuntimePermission("org.jboss.security.negotiation.getDelegCredential"),
            // Permissions for PropagateIdentityServlet to read properties
            new PropertyPermission(GSSTestConstants.PROPERTY_PORT, "read"),
            new PropertyPermission(GSSTestConstants.PROPERTY_PRINCIPAL, "read"),
            new PropertyPermission(GSSTestConstants.PROPERTY_PASSWORD, "read"),
            // Permissions for GSSTestClient to connect to GSSTestServer
            new SocketPermission(TestSuiteEnvironment.getServerAddress(), "resolve,connect"),
            new SocketPermission(CoreUtils.getCannonicalHost(TestSuiteEnvironment.getServerAddress()),
                    "resolve,connect"),
            // Permissions for GSSTestClient to initiate gss context
            new ServicePermission(GSSTestConstants.PRINCIPAL, "initiate"),
            new ServicePermission("krbtgt/JBOSS.ORG@JBOSS.ORG", "initiate")), "permissions.xml");
    return war;
}