/** * Lists all certs on all keys on all tokens. * * @throws Exception if an error occurs */ @Command(description = "Lists all certs on all keys on all tokens") public void listCerts() throws Exception { List<TokenInfo> tokens = SignerClient.execute(new ListTokens()); tokens.forEach( t -> { printTokenInfo(t, verbose); if (verbose) { System.out.println("Keys: "); } t.getKeyInfo() .forEach( k -> { printKeyInfo(k, verbose, "\t"); if (verbose) { System.out.println("\tCerts: "); } printCertInfo(k, verbose, "\t\t"); }); System.out.println(); }); }
private static URI[] getServiceAddresses(ServiceId serviceProvider, SecurityServerId serverId) throws Exception { log.trace("getServiceAddresses({})", serviceProvider); Collection<String> hostNames = GlobalConf.getProviderAddress(serviceProvider.getClientId()); if (hostNames == null || hostNames.isEmpty()) { throw new CodedException( X_UNKNOWN_MEMBER, "Could not find addresses for service provider \"%s\"", serviceProvider); } if (serverId != null) { final String securityServerAddress = GlobalConf.getSecurityServerAddress(serverId); if (securityServerAddress == null) { throw new CodedException( X_INVALID_SECURITY_SERVER, "Could not find security server \"%s\"", serverId); } if (!hostNames.contains(securityServerAddress)) { throw new CodedException( X_INVALID_SECURITY_SERVER, "Invalid security server \"%s\"", serviceProvider); } hostNames = Collections.singleton(securityServerAddress); } String protocol = SystemProperties.isSslEnabled() ? "https" : "http"; int port = SystemProperties.getServerProxyPort(); List<URI> addresses = new ArrayList<>(hostNames.size()); for (String host : hostNames) { addresses.add(new URI(protocol, null, host, port, "/", null, null)); } return addresses.toArray(new URI[] {}); }
/** * Lists all tokens. * * @throws Exception if an error occurs */ @Command(description = "Lists all tokens") public void listTokens() throws Exception { List<TokenInfo> tokens = SignerClient.execute(new ListTokens()); tokens.forEach(t -> printTokenInfo(t, verbose)); }