private void printAppConfigurationDetails(PrintWriter pw) { Map<String, Realm> configs = getConfigurationDetails(); if (configs.isEmpty()) { pw.println("No JAAS LoginModule registered"); return; } pw.println("<p class=\"statline ui-state-highlight\">${Registered LoginModules}</p>"); pw.println("<table class=\"nicetable\">"); pw.println("<thead><tr>"); pw.println("<th class=\"header\">${Realm}</th>"); pw.println("<th class=\"header\">${Rank}</th>"); pw.println("<th class=\"header\">${Control Flag}</th>"); pw.println("<th class=\"header\">${Type}</th>"); pw.println("<th class=\"header\">${Classname}</th>"); pw.println("</tr></thead>"); for (Realm r : configs.values()) { String realmName = r.getRealmName(); pw.printf( "<tr class=\"ui-state-default\"><td>%s</td><td colspan=\"4\"></td></tr>", realmName); String rowClass = "odd"; for (AppConfigurationHolder ah : r.getConfigs()) { LoginModuleProvider lp = ah.getProvider(); String type = getType(lp); pw.printf("<tr class=\"%s ui-state-default\"><td></td><td>%d</td>", rowClass, lp.ranking()); pw.printf("<td>%s</td>", ControlFlag.toString(lp.getControlFlag())); pw.printf("<td>%s</td>", type); pw.printf("<td>"); pw.print(lp.getClassName()); if (lp instanceof OsgiLoginModuleProvider) { ServiceReference sr = ((OsgiLoginModuleProvider) lp).getServiceReference(); Object id = sr.getProperty(Constants.SERVICE_ID); pw.printf("<a href=\"${pluginRoot}/../services/%s\">(%s)</a>", id, id); } else if (lp instanceof ConfigLoginModuleProvider) { Map config = lp.options(); Object id = config.get(Constants.SERVICE_PID); pw.printf("<a href=\"${pluginRoot}/../configMgr/%s\">(Details)</a>", id); } pw.printf("</td>"); pw.println("</tr>"); if (rowClass.equals("odd")) { rowClass = "even"; } else { rowClass = "odd"; } } } pw.println("</table>"); }
/** * @see org.apache.felix.webconsole.ConfigurationPrinter#printConfiguration(java.io.PrintWriter) */ @SuppressWarnings("UnusedDeclaration") public void printConfiguration(final PrintWriter pw) { pw.println("JAAS Configuration Details:"); pw.println(); pw.println("Registered LoginModules"); Map<String, Realm> configs = getConfigurationDetails(); if (configs.isEmpty()) { pw.println("No JAAS LoginModule registered"); } else { for (Realm r : configs.values()) { String realmName = r.getRealmName(); pw.printf("Realm : %s \n", realmName); for (AppConfigurationHolder ah : r.getConfigs()) { addSpace(pw, 1); pw.printf("%s \n", ah.getProvider().getClassName()); addSpace(pw, 2); pw.printf("Flag : %s \n", ControlFlag.toString(ah.getProvider().getControlFlag())); addSpace(pw, 2); pw.printf("Type : %s \n", getType(ah.getProvider())); addSpace(pw, 2); pw.printf("Ranking : %d \n", ah.getProvider().ranking()); } } } pw.println(); Map<Bundle, Set<String>> bundleMap = getAvailableLoginModuleInfo(); pw.println("Available LoginModules"); if (bundleMap.isEmpty()) { // Nothing to do } else { for (Map.Entry<Bundle, Set<String>> e : bundleMap.entrySet()) { Bundle b = e.getKey(); pw.printf("%s (%s) \n", b.getSymbolicName(), b.getBundleId()); for (String className : e.getValue()) { addSpace(pw, 1); pw.println(className); } } } }