/** * Construct with prepared AdminConfig. * @param adminConfig The krb config */ public AdminClient(AdminConfig adminConfig) { this.adminConfig = adminConfig; this.commonOptions = new KOptions(); this.adminSetting = new AdminSetting(commonOptions, adminConfig); }
/** * Check kdc tcp setting and see if any bad. * @return valid tcp port or -1 if not allowTcp * @throws KrbException e */ public int checkGetKdcTcpPort() throws KrbException { if (allowTcp()) { int kdcPort = getKdcTcpPort(); if (kdcPort < 1) { throw new KrbException("KDC tcp port isn't set or configured"); } return kdcPort; } return -1; }
/** * Check kdc udp setting and see if any bad. * @return valid udp port or -1 if not allowUdp * @throws KrbException e */ public int checkGetKdcUdpPort() throws KrbException { if (allowUdp()) { int kdcPort = getKdcUdpPort(); if (kdcPort < 1) { throw new KrbException("KDC udp port isn't set or configured"); } return kdcPort; } return -1; }
/** * Get KDC network transport addresses according to krb client setting. * @param setting The krb setting * @return UDP and TCP addresses pair * @throws KrbException e */ public static TransportPair getTransportPair( AdminSetting setting) throws KrbException { TransportPair result = new TransportPair(); int tcpPort = setting.checkGetKdcTcpPort(); if (tcpPort > 0) { result.tcpAddress = new InetSocketAddress( setting.getKdcHost(), tcpPort); } int udpPort = setting.checkGetKdcUdpPort(); if (udpPort > 0) { result.udpAddress = new InetSocketAddress( setting.getKdcHost(), udpPort); } return result; } }
network.setSocketTimeout(adminClient.getSetting().getTimeout()); adminClient.getSetting().getKdcRealm()).getName(); Subject subject = null; try {
/** * Fix principal name. * * @param principal The principal name * @return The fixed principal */ protected String fixPrincipal(String principal) { if (!principal.contains("@")) { principal += "@" + krbSetting.getKdcRealm(); } return principal; } }
/** * Get krbconfig. * @return The krb config */ public AdminConfig getConfig() { return adminSetting.getAdminConfig(); } }
/** * Get KDC network transport addresses according to krb client setting. * @param setting The krb setting * @return UDP and TCP addresses pair * @throws KrbException e */ public static TransportPair getTransportPair( AdminSetting setting) throws KrbException { TransportPair result = new TransportPair(); int tcpPort = setting.checkGetKdcTcpPort(); if (tcpPort > 0) { result.tcpAddress = new InetSocketAddress( setting.getKdcHost(), tcpPort); } int udpPort = setting.checkGetKdcUdpPort(); if (udpPort > 0) { result.udpAddress = new InetSocketAddress( setting.getKdcHost(), udpPort); } return result; } }
network.setSocketTimeout(adminClient.getSetting().getTimeout()); adminClient.getSetting().getKdcRealm()).getName(); Subject subject = null; try {
/** * Fix principal name. * * @param principal The principal name * @return The fixed principal */ protected String fixPrincipal(String principal) { if (!principal.contains("@")) { principal += "@" + krbSetting.getKdcRealm(); } return principal; } }
/** * Get krbconfig. * @return The krb config */ public AdminConfig getConfig() { return adminSetting.getAdminConfig(); } }
/** * Check kdc udp setting and see if any bad. * @return valid udp port or -1 if not allowUdp * @throws KrbException e */ public int checkGetKdcUdpPort() throws KrbException { if (allowUdp()) { int kdcPort = getKdcUdpPort(); if (kdcPort < 1) { throw new KrbException("KDC udp port isn't set or configured"); } return kdcPort; } return -1; }
/** * Check kdc tcp setting and see if any bad. * @return valid tcp port or -1 if not allowTcp * @throws KrbException e */ public int checkGetKdcTcpPort() throws KrbException { if (allowTcp()) { int kdcPort = getKdcTcpPort(); if (kdcPort < 1) { throw new KrbException("KDC tcp port isn't set or configured"); } return kdcPort; } return -1; }
/** * Construct with prepared AdminConfig. * @param adminConfig The krb config */ public AdminClient(AdminConfig adminConfig) { this.adminConfig = adminConfig; this.commonOptions = new KOptions(); this.adminSetting = new AdminSetting(commonOptions, adminConfig); }
@Override public String getKadminPrincipal() { return KrbUtil.makeKadminPrincipal(innerClient.getSetting().getKdcRealm()).getName(); }
/** * Default constructor. * @throws KrbException e */ public AdminClient() throws KrbException { this.adminConfig = AdminUtil.getDefaultConfig(); this.commonOptions = new KOptions(); this.adminSetting = new AdminSetting(commonOptions, adminConfig); }
@Override public String getKadminPrincipal() { return KrbUtil.makeKadminPrincipal(innerClient.getSetting().getKdcRealm()).getName(); }
/** * Default constructor. * @throws KrbException e */ public AdminClient() throws KrbException { this.adminConfig = AdminUtil.getDefaultConfig(); this.commonOptions = new KOptions(); this.adminSetting = new AdminSetting(commonOptions, adminConfig); }
/** * Constructor with conf dir * @param confDir The conf dir * @throws KrbException e */ public AdminClient(File confDir) throws KrbException { this.commonOptions = new KOptions(); this.adminConfig = AdminUtil.getConfig(confDir); this.adminSetting = new AdminSetting(commonOptions, adminConfig); }
/** * Constructor with conf dir * @param confDir The conf dir * @throws KrbException e */ public AdminClient(File confDir) throws KrbException { this.commonOptions = new KOptions(); this.adminConfig = AdminUtil.getConfig(confDir); this.adminSetting = new AdminSetting(commonOptions, adminConfig); }