if (authenticatedUser == null) { if (log.isDebugEnabled()) {
log.debug(sm.getString("combinedRealm.authFail", username, realm.getClass().getName()));
}
} else { if (log.isDebugEnabled()) {
log.debug(sm.getString("combinedRealm.authSuccess", username, realm.getClass().getName()));
} break;
}
} return authenticatedUser;
}
@Override publicvoid setContainer(Container container) { for (Realm realm : realms) { // Set the realmPath for JMX naming if (realm instanceof RealmBase) {
((RealmBase) realm).setRealmPath(getRealmPath() + "/realm" + realms.indexOf(realm));
}
// Set the container for sub-realms. Mainly so logging works.
realm.setContainer(container);
} super.setContainer(container);
}
@Override protectedvoid startInternal() throws LifecycleException { // Start 'sub-realms' then this one
Iterator<Realm> iter = realms.iterator();
while (iter.hasNext()) {
Realm realm = iter.next(); if (realm instanceof Lifecycle) { try {
((Lifecycle) realm).start();
} catch (LifecycleException e) { // If realm doesn't start can't authenticate against it
iter.remove();
log.error(sm.getString("combinedRealm.realmStartFail", realm.getClass().getName()), e);
}
}
}
if (getCredentialHandler() == null) { // Set a credential handler that will ask the nested realms so that it can // be set by the context in the attributes, it won't be used directly super.setCredentialHandler(new CombinedRealmCredentialHandler());
} super.startInternal();
}
@Override protectedvoid stopInternal() throws LifecycleException { // Stop this realm, then the sub-realms (reverse order to start) super.stopInternal(); for (Realm realm : realms) { if (realm instanceof Lifecycle) {
((Lifecycle) realm).stop();
}
}
}
if (authenticatedUser == null) { if (log.isDebugEnabled()) {
log.debug(sm.getString("combinedRealm.authFail", gssName, realm.getClass().getName()));
}
} else { if (log.isDebugEnabled()) {
log.debug(sm.getString("combinedRealm.authSuccess", gssName, realm.getClass().getName()));
} break;
}
} return authenticatedUser;
}
@Override publicboolean hasRole(Wrapper wrapper, Principal principal, String role) { for (Realm realm : realms) { if (realm.hasRole(wrapper, principal, role)) { returntrue;
}
} returnfalse;
}
@Override protected String getPassword(String username) { // This method should never be called // Stack trace will show where this was called from
UnsupportedOperationException uoe = new UnsupportedOperationException(sm.getString("combinedRealm.getPassword"));
log.error(sm.getString("combinedRealm.unexpectedMethod"), uoe); throw uoe;
}
@Override protected Principal getPrincipal(String username) { // This method should never be called // Stack trace will show where this was called from
UnsupportedOperationException uoe = new UnsupportedOperationException(sm.getString("combinedRealm.getPrincipal"));
log.error(sm.getString("combinedRealm.unexpectedMethod"), uoe); throw uoe;
}
@Override publicboolean isAvailable() { for (Realm realm : realms) { if (!realm.isAvailable()) { returnfalse;
}
} returntrue;
}
@Override publicvoid setCredentialHandler(CredentialHandler credentialHandler) { // This is unusual for a CombinedRealm as it does not use // CredentialHandlers. It might be a mis-configuration so warn the user.
log.warn(sm.getString("combinedRealm.setCredentialHandler")); super.setCredentialHandler(credentialHandler);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.