if (secHolder != null)
securityRealmName = secHolder.getSecurityRealm();
//Did we declare a GBean at the context level?
if (ctx.getRealm() != null) {
Realm realm = ctx.getRealm();
//Allow for the <security-realm-name> override from the
//geronimo-web.xml file to be used if our Realm is a JAAS type
if (securityRealmName != null) {
if (realm instanceof JAASRealm) {
((JAASRealm) realm).setAppName(securityRealmName);
}
}
anotherCtxObj.setRealm(realm);
} else {
Realm realm = host.getRealm();
//Check and see if we have a declared realm name and no match to a parent name
if (securityRealmName != null) {
String parentRealmName = null;
if (realm instanceof JAASRealm) {
parentRealmName = ((JAASRealm) realm).getAppName();
}
//Do we have a match to a parent?
if (!securityRealmName.equals(parentRealmName)) {
//No...we need to create a default adapter
//Is the context requiring JACC?
if (secHolder.isSecurity()) {
//JACC
realm = new TomcatGeronimoRealm();
} else {
//JAAS
realm = new TomcatJAASRealm();
}
if (log.isDebugEnabled()) {
log.debug("The security-realm-name '" + securityRealmName +
"' was specified and a parent (Engine/Host) is not named the same or no RealmGBean was configured for this context. " +
"Creating a default " + realm.getClass().getName() +
" adapter for this context.");
}
((JAASRealm) realm).setUserClassNames("org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal");
((JAASRealm) realm).setRoleClassNames("org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal");