Example usage for javax.security.auth.kerberos ServicePermission ServicePermission

List of usage examples for javax.security.auth.kerberos ServicePermission ServicePermission

Introduction

In this page you can find the example usage for javax.security.auth.kerberos ServicePermission ServicePermission.

Prototype

ServicePermission(String servicePrincipal, int mask) 

Source Link

Document

Creates a ServicePermission object with the specified servicePrincipal and a pre-calculated mask.

Usage

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

/**
 * Creates {@link WebArchive}.//from  w  ww  .j a va 2 s. c om
 *
 * @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;
}