Methods Summary |
---|
public void | authRealmCreated(com.sun.enterprise.admin.event.AuthRealmEvent event)New auth realm created.
It is called whenever a AuthRealmEvent with action of
AuthRealmEvent.ACTION_CREATE is received.
try {
createRealm(event);
} catch(Exception ex) {
throw new AdminEventListenerException(ex);
}
|
public void | authRealmDeleted(com.sun.enterprise.admin.event.AuthRealmEvent event)Auth realm deleted.
It is called whenever a AuthRealmEvent with action of
AuthRealmEvent.ACTION_DELETE is received.
try {
//only unload the realm, keep any auxiliary file for sanity
Realm.unloadInstance(event.getAuthRealmName());
} catch(Exception ex) {
throw new AdminEventListenerException(ex);
}
|
public void | authRealmUpdated(com.sun.enterprise.admin.event.AuthRealmEvent event)Auth realm updated (attributes change).
It is called whenever a AuthRealmEvent with action of
AuthRealmEvent.ACTION_UPDATE is received.
try {
//XXX replace with a new realm, need to revisit in JSR 196
createRealm(event);
} catch(Exception ex) {
throw new AdminEventListenerException(ex);
}
|
private void | createRealm(com.sun.enterprise.admin.event.AuthRealmEvent event)This method will create or replace existing realm with a new one
in cache.
ConfigContext configContext = event.getConfigContext();
String realmName = event.getAuthRealmName();
SecurityService security =
ServerBeansFactory.getSecurityServiceBean(configContext);
AuthRealm authRealm = security.getAuthRealmByName(realmName);
//authRealm cannot be null here
String className = authRealm.getClassname();
ElementProperty[] elementProps = authRealm.getElementProperty();
int size = (elementProps != null) ? elementProps.length : 0;
Properties props = new Properties();
for (int i = 0; i < size; i++) {
props.setProperty(elementProps[i].getName(),
elementProps[i].getValue());
}
if ("com.sun.enterprise.security.auth.realm.file.FileRealm".equals(className)) {
SecuritySupport secSupp = SecurityUtil.getSecuritySupport();
secSupp.synchronizeKeyFile(configContext, realmName);
}
Realm.instantiate(realmName, className, props);
|