/* * (non-Javadoc) * * @see org.jboss.system.ServiceMBeanSupport#startService() */ @Override @ManagementOperation(description = "Service lifecycle operation", impact = Impact.WriteOnly) protected void startService() throws Exception { // Load the secret key loadPBESecretKey(); // Load the key and/or truststore into memory loadKeyAndTrustStore(); // Only register with the JaasSecurityManagerService if its defined if (managerServiceName != null) { /* * Register with the JaasSecurityManagerServiceMBean. This allows this JaasSecurityDomain to function as the * security manager for security-domain elements that declare java:/jaas/xxx for our security domain name. */ MBeanServer server = MBeanServerLocator.locateJBoss(); Object[] params = {getSecurityDomain(), this}; String[] signature = new String[] {"java.lang.String", "org.jboss.security.SecurityDomain"}; server.invoke(managerServiceName, "registerSecurityDomain", params, signature); } // Register yourself with the security management if (securityManagement instanceof JNDIBasedSecurityManagement) { JNDIBasedSecurityManagement jbs = (JNDIBasedSecurityManagement) securityManagement; jbs.registerJaasSecurityDomainInstance(this); } }
/* * (non-Javadoc) * * @see org.jboss.system.ServiceMBeanSupport#stopService() */ @Override @ManagementOperation(description = "Service lifecycle operation", impact = Impact.WriteOnly) protected void stopService() { if (keyStorePassword != null) { Arrays.fill(keyStorePassword, '\0'); keyStorePassword = null; } if (serviceAuthToken != null) { Arrays.fill(serviceAuthToken, '\0'); serviceAuthToken = null; } cipherKey = null; // Deregister yourself with the security management if (securityManagement instanceof JNDIBasedSecurityManagement) { JNDIBasedSecurityManagement jbs = (JNDIBasedSecurityManagement) securityManagement; jbs.deregisterJaasSecurityDomainInstance(getSecurityDomain()); } }