getContext().getLogger().fine("Finding realm...");
boolean found = false;
String realmName = AuthApplication.getStringAttribute(request,"realm-name",null);
if (realmName!=null) {
try {
Realm realm = db.getRealm(realmName);
if (realm!=null) {
if (getContext().getLogger().isLoggable(Level.FINE)) {
getContext().getLogger().fine("Found realm by name "+realmName);
}
found = true;
request.getAttributes().put(AuthApplication.REALM_ATTR,realm);
}
} catch (SQLException ex) {
getContext().getLogger().log(Level.SEVERE,"Cannot retrieve realm.",ex);
}
}
String realmId = AuthApplication.getStringAttribute(request,"realm-id",null);
if (realmId!=null && !found) {
try {
Realm realm = db.getRealm(UUID.fromString(realmId));
if (realm!=null) {
if (getContext().getLogger().isLoggable(Level.FINE)) {
getContext().getLogger().fine("Found realm by id "+realmId);
}
found = true;