Java Code Examples for javax.security.auth.kerberos.KerberosPrincipal#KRB_NT_SRV_INST
The following examples show how to use
javax.security.auth.kerberos.KerberosPrincipal#KRB_NT_SRV_INST .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Krb5Util.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public static KerberosTicket credsToTicket(Credentials serviceCreds) { EncryptionKey sessionKey = serviceCreds.getSessionKey(); return new KerberosTicket( serviceCreds.getEncoded(), new KerberosPrincipal(serviceCreds.getClient().getName()), new KerberosPrincipal(serviceCreds.getServer().getName(), KerberosPrincipal.KRB_NT_SRV_INST), sessionKey.getBytes(), sessionKey.getEType(), serviceCreds.getFlags(), serviceCreds.getAuthTime(), serviceCreds.getStartTime(), serviceCreds.getEndTime(), serviceCreds.getRenewTill(), serviceCreds.getClientAddresses()); }
Example 2
Source File: Krb5Util.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static KerberosTicket credsToTicket(Credentials serviceCreds) { EncryptionKey sessionKey = serviceCreds.getSessionKey(); return new KerberosTicket( serviceCreds.getEncoded(), new KerberosPrincipal(serviceCreds.getClient().getName()), new KerberosPrincipal(serviceCreds.getServer().getName(), KerberosPrincipal.KRB_NT_SRV_INST), sessionKey.getBytes(), sessionKey.getEType(), serviceCreds.getFlags(), serviceCreds.getAuthTime(), serviceCreds.getStartTime(), serviceCreds.getEndTime(), serviceCreds.getRenewTill(), serviceCreds.getClientAddresses()); }
Example 3
Source File: Krb5Util.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static KerberosTicket credsToTicket(Credentials serviceCreds) { EncryptionKey sessionKey = serviceCreds.getSessionKey(); return new KerberosTicket( serviceCreds.getEncoded(), new KerberosPrincipal(serviceCreds.getClient().getName()), new KerberosPrincipal(serviceCreds.getServer().getName(), KerberosPrincipal.KRB_NT_SRV_INST), sessionKey.getBytes(), sessionKey.getEType(), serviceCreds.getFlags(), serviceCreds.getAuthTime(), serviceCreds.getStartTime(), serviceCreds.getEndTime(), serviceCreds.getRenewTill(), serviceCreds.getClientAddresses()); }
Example 4
Source File: Krb5Util.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public static KerberosTicket credsToTicket(Credentials serviceCreds) { EncryptionKey sessionKey = serviceCreds.getSessionKey(); return new KerberosTicket( serviceCreds.getEncoded(), new KerberosPrincipal(serviceCreds.getClient().getName()), new KerberosPrincipal(serviceCreds.getServer().getName(), KerberosPrincipal.KRB_NT_SRV_INST), sessionKey.getBytes(), sessionKey.getEType(), serviceCreds.getFlags(), serviceCreds.getAuthTime(), serviceCreds.getStartTime(), serviceCreds.getEndTime(), serviceCreds.getRenewTill(), serviceCreds.getClientAddresses()); }
Example 5
Source File: Krb5Util.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public static KerberosTicket credsToTicket(Credentials serviceCreds) { EncryptionKey sessionKey = serviceCreds.getSessionKey(); return new KerberosTicket( serviceCreds.getEncoded(), new KerberosPrincipal(serviceCreds.getClient().getName()), new KerberosPrincipal(serviceCreds.getServer().getName(), KerberosPrincipal.KRB_NT_SRV_INST), sessionKey.getBytes(), sessionKey.getEType(), serviceCreds.getFlags(), serviceCreds.getAuthTime(), serviceCreds.getStartTime(), serviceCreds.getEndTime(), serviceCreds.getRenewTill(), serviceCreds.getClientAddresses()); }
Example 6
Source File: KPEquals.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { new OneKDC(null).writeJAASConf(); Context c = Context.fromJAAS("client"); Context s = Context.fromThinAir(); KerberosPrincipal kp = new KerberosPrincipal( OneKDC.SERVER + "@" + OneKDC.REALM, KerberosPrincipal.KRB_NT_SRV_INST); s.s().getPrincipals().add(kp); for (KerberosKey k: KeyTab.getInstance(kp).getKeys(kp)) { s.s().getPrivateCredentials().add(k); } c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); s.startAsServer(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); Context.handshake(c, s); }
Example 7
Source File: Krb5Util.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static KerberosTicket credsToTicket(Credentials serviceCreds) { EncryptionKey sessionKey = serviceCreds.getSessionKey(); KerberosTicket kt = new KerberosTicket( serviceCreds.getEncoded(), new KerberosPrincipal(serviceCreds.getClient().getName()), new KerberosPrincipal(serviceCreds.getServer().getName(), KerberosPrincipal.KRB_NT_SRV_INST), sessionKey.getBytes(), sessionKey.getEType(), serviceCreds.getFlags(), serviceCreds.getAuthTime(), serviceCreds.getStartTime(), serviceCreds.getEndTime(), serviceCreds.getRenewTill(), serviceCreds.getClientAddresses()); PrincipalName clientAlias = serviceCreds.getClientAlias(); PrincipalName serverAlias = serviceCreds.getServerAlias(); if (clientAlias != null) { KerberosSecrets.getJavaxSecurityAuthKerberosAccess() .kerberosTicketSetClientAlias(kt, new KerberosPrincipal( clientAlias.getName(), clientAlias.getNameType())); } if (serverAlias != null) { KerberosSecrets.getJavaxSecurityAuthKerberosAccess() .kerberosTicketSetServerAlias(kt, new KerberosPrincipal( serverAlias.getName(), serverAlias.getNameType())); } return kt; }
Example 8
Source File: KPEquals.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { new OneKDC(null).writeJAASConf(); Context c = Context.fromJAAS("client"); Context s = Context.fromThinAir(); KerberosPrincipal kp = new KerberosPrincipal( OneKDC.SERVER + "@" + OneKDC.REALM, KerberosPrincipal.KRB_NT_SRV_INST); s.s().getPrincipals().add(kp); for (KerberosKey k: KeyTab.getInstance(kp).getKeys(kp)) { s.s().getPrivateCredentials().add(k); } c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); s.startAsServer(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); Context.handshake(c, s); }
Example 9
Source File: Krb5Util.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static KerberosTicket credsToTicket(Credentials serviceCreds) { EncryptionKey sessionKey = serviceCreds.getSessionKey(); KerberosTicket kt = new KerberosTicket( serviceCreds.getEncoded(), new KerberosPrincipal(serviceCreds.getClient().getName()), new KerberosPrincipal(serviceCreds.getServer().getName(), KerberosPrincipal.KRB_NT_SRV_INST), sessionKey.getBytes(), sessionKey.getEType(), serviceCreds.getFlags(), serviceCreds.getAuthTime(), serviceCreds.getStartTime(), serviceCreds.getEndTime(), serviceCreds.getRenewTill(), serviceCreds.getClientAddresses()); PrincipalName clientAlias = serviceCreds.getClientAlias(); PrincipalName serverAlias = serviceCreds.getServerAlias(); if (clientAlias != null) { KerberosSecrets.getJavaxSecurityAuthKerberosAccess() .kerberosTicketSetClientAlias(kt, new KerberosPrincipal( clientAlias.getName(), clientAlias.getNameType())); } if (serverAlias != null) { KerberosSecrets.getJavaxSecurityAuthKerberosAccess() .kerberosTicketSetServerAlias(kt, new KerberosPrincipal( serverAlias.getName(), serverAlias.getNameType())); } return kt; }
Example 10
Source File: KPEquals.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { new OneKDC(null).writeJAASConf(); Context c = Context.fromJAAS("client"); Context s = Context.fromThinAir(); KerberosPrincipal kp = new KerberosPrincipal( OneKDC.SERVER + "@" + OneKDC.REALM, KerberosPrincipal.KRB_NT_SRV_INST); s.s().getPrincipals().add(kp); for (KerberosKey k: KeyTab.getInstance(kp).getKeys(kp)) { s.s().getPrivateCredentials().add(k); } c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); s.startAsServer(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); Context.handshake(c, s); }
Example 11
Source File: KPEquals.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { new OneKDC(null).writeJAASConf(); Context c = Context.fromJAAS("client"); Context s = Context.fromThinAir(); KerberosPrincipal kp = new KerberosPrincipal( OneKDC.SERVER + "@" + OneKDC.REALM, KerberosPrincipal.KRB_NT_SRV_INST); s.s().getPrincipals().add(kp); for (KerberosKey k: KeyTab.getInstance(kp).getKeys(kp)) { s.s().getPrivateCredentials().add(k); } c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); s.startAsServer(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); Context.handshake(c, s); }
Example 12
Source File: Krb5Util.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static KerberosTicket credsToTicket(Credentials serviceCreds) { EncryptionKey sessionKey = serviceCreds.getSessionKey(); KerberosTicket kt = new KerberosTicket( serviceCreds.getEncoded(), new KerberosPrincipal(serviceCreds.getClient().getName()), new KerberosPrincipal(serviceCreds.getServer().getName(), KerberosPrincipal.KRB_NT_SRV_INST), sessionKey.getBytes(), sessionKey.getEType(), serviceCreds.getFlags(), serviceCreds.getAuthTime(), serviceCreds.getStartTime(), serviceCreds.getEndTime(), serviceCreds.getRenewTill(), serviceCreds.getClientAddresses()); PrincipalName clientAlias = serviceCreds.getClientAlias(); PrincipalName serverAlias = serviceCreds.getServerAlias(); if (clientAlias != null) { KerberosSecrets.getJavaxSecurityAuthKerberosAccess() .kerberosTicketSetClientAlias(kt, new KerberosPrincipal( clientAlias.getName(), clientAlias.getNameType())); } if (serverAlias != null) { KerberosSecrets.getJavaxSecurityAuthKerberosAccess() .kerberosTicketSetServerAlias(kt, new KerberosPrincipal( serverAlias.getName(), serverAlias.getNameType())); } return kt; }
Example 13
Source File: Krb5Util.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static KerberosTicket credsToTicket(Credentials serviceCreds) { EncryptionKey sessionKey = serviceCreds.getSessionKey(); KerberosTicket kt = new KerberosTicket( serviceCreds.getEncoded(), new KerberosPrincipal(serviceCreds.getClient().getName()), new KerberosPrincipal(serviceCreds.getServer().getName(), KerberosPrincipal.KRB_NT_SRV_INST), sessionKey.getBytes(), sessionKey.getEType(), serviceCreds.getFlags(), serviceCreds.getAuthTime(), serviceCreds.getStartTime(), serviceCreds.getEndTime(), serviceCreds.getRenewTill(), serviceCreds.getClientAddresses()); PrincipalName clientAlias = serviceCreds.getClientAlias(); PrincipalName serverAlias = serviceCreds.getServerAlias(); if (clientAlias != null) { KerberosSecrets.getJavaxSecurityAuthKerberosAccess() .kerberosTicketSetClientAlias(kt, new KerberosPrincipal( clientAlias.getName(), clientAlias.getNameType())); } if (serverAlias != null) { KerberosSecrets.getJavaxSecurityAuthKerberosAccess() .kerberosTicketSetServerAlias(kt, new KerberosPrincipal( serverAlias.getName(), serverAlias.getNameType())); } return kt; }
Example 14
Source File: KPEquals.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { new OneKDC(null).writeJAASConf(); Context c = Context.fromJAAS("client"); Context s = Context.fromThinAir(); KerberosPrincipal kp = new KerberosPrincipal( OneKDC.SERVER + "@" + OneKDC.REALM, KerberosPrincipal.KRB_NT_SRV_INST); s.s().getPrincipals().add(kp); for (KerberosKey k: KeyTab.getInstance(kp).getKeys(kp)) { s.s().getPrivateCredentials().add(k); } c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); s.startAsServer(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); Context.handshake(c, s); }
Example 15
Source File: AddressesAndNameType.java From hottub with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { OneKDC kdc = new OneKDC(null); kdc.writeJAASConf(); String extraLine; switch (args[0]) { case "1": extraLine = "noaddresses = false"; break; case "2": extraLine = "noaddresses = true"; break; default: extraLine = ""; break; } KDC.saveConfig(OneKDC.KRB5_CONF, kdc, extraLine); Config.refresh(); Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); Set<KerberosTicket> tickets = c.s().getPrivateCredentials(KerberosTicket.class); if (tickets.isEmpty()) throw new Exception(); KerberosTicket ticket = tickets.iterator().next(); InetAddress[] addresses = ticket.getClientAddresses(); switch (args[0]) { case "1": if (addresses == null || addresses.length == 0) { throw new Exception("No addresses"); } if (ticket.getServer().getNameType() != KerberosPrincipal.KRB_NT_SRV_INST) { throw new Exception( "Wrong type: " + ticket.getServer().getNameType()); } break; default: if (addresses != null && addresses.length != 0) { throw new Exception("See addresses"); } break; } }
Example 16
Source File: AddressesAndNameType.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { OneKDC kdc = new OneKDC(null); kdc.writeJAASConf(); String extraLine; switch (args[0]) { case "1": extraLine = "noaddresses = false"; break; case "2": extraLine = "noaddresses = true"; break; default: extraLine = ""; break; } KDC.saveConfig(OneKDC.KRB5_CONF, kdc, extraLine); Config.refresh(); Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); Set<KerberosTicket> tickets = c.s().getPrivateCredentials(KerberosTicket.class); if (tickets.isEmpty()) throw new Exception(); KerberosTicket ticket = tickets.iterator().next(); InetAddress[] addresses = ticket.getClientAddresses(); switch (args[0]) { case "1": if (addresses == null || addresses.length == 0) { throw new Exception("No addresses"); } if (ticket.getServer().getNameType() != KerberosPrincipal.KRB_NT_SRV_INST) { throw new Exception( "Wrong type: " + ticket.getServer().getNameType()); } break; default: if (addresses != null && addresses.length != 0) { throw new Exception("See addresses"); } break; } }
Example 17
Source File: AddressesAndNameType.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { OneKDC kdc = new OneKDC(null); kdc.writeJAASConf(); String extraLine; switch (args[0]) { case "1": extraLine = "noaddresses = false"; break; case "2": extraLine = "noaddresses = true"; break; default: extraLine = ""; break; } KDC.saveConfig(OneKDC.KRB5_CONF, kdc, extraLine); Config.refresh(); Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); Set<KerberosTicket> tickets = c.s().getPrivateCredentials(KerberosTicket.class); if (tickets.isEmpty()) throw new Exception(); KerberosTicket ticket = tickets.iterator().next(); InetAddress[] addresses = ticket.getClientAddresses(); switch (args[0]) { case "1": if (addresses == null || addresses.length == 0) { throw new Exception("No addresses"); } if (ticket.getServer().getNameType() != KerberosPrincipal.KRB_NT_SRV_INST) { throw new Exception( "Wrong type: " + ticket.getServer().getNameType()); } break; default: if (addresses != null && addresses.length != 0) { throw new Exception("See addresses"); } break; } }
Example 18
Source File: AddressesAndNameType.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { OneKDC kdc = new OneKDC(null); kdc.writeJAASConf(); String extraLine; switch (args[0]) { case "1": extraLine = "noaddresses = false"; break; case "2": extraLine = "noaddresses = true"; break; default: extraLine = ""; break; } KDC.saveConfig(OneKDC.KRB5_CONF, kdc, extraLine); Config.refresh(); Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); Set<KerberosTicket> tickets = c.s().getPrivateCredentials(KerberosTicket.class); if (tickets.isEmpty()) throw new Exception(); KerberosTicket ticket = tickets.iterator().next(); InetAddress[] addresses = ticket.getClientAddresses(); switch (args[0]) { case "1": if (addresses == null || addresses.length == 0) { throw new Exception("No addresses"); } if (ticket.getServer().getNameType() != KerberosPrincipal.KRB_NT_SRV_INST) { throw new Exception( "Wrong type: " + ticket.getServer().getNameType()); } break; default: if (addresses != null && addresses.length != 0) { throw new Exception("See addresses"); } break; } }
Example 19
Source File: AddressesAndNameType.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { OneKDC kdc = new OneKDC(null); kdc.writeJAASConf(); String extraLine; switch (args[0]) { case "1": extraLine = "noaddresses = false"; break; case "2": extraLine = "noaddresses = true"; break; default: extraLine = ""; break; } KDC.saveConfig(OneKDC.KRB5_CONF, kdc, extraLine); Config.refresh(); Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); Set<KerberosTicket> tickets = c.s().getPrivateCredentials(KerberosTicket.class); if (tickets.isEmpty()) throw new Exception(); KerberosTicket ticket = tickets.iterator().next(); InetAddress[] addresses = ticket.getClientAddresses(); switch (args[0]) { case "1": if (addresses == null || addresses.length == 0) { throw new Exception("No addresses"); } if (ticket.getServer().getNameType() != KerberosPrincipal.KRB_NT_SRV_INST) { throw new Exception( "Wrong type: " + ticket.getServer().getNameType()); } break; default: if (addresses != null && addresses.length != 0) { throw new Exception("See addresses"); } break; } }
Example 20
Source File: AddressesAndNameType.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { OneKDC kdc = new OneKDC(null); kdc.writeJAASConf(); String extraLine; switch (args[0]) { case "1": extraLine = "noaddresses = false"; break; case "2": extraLine = "noaddresses = true"; break; default: extraLine = ""; break; } KDC.saveConfig(OneKDC.KRB5_CONF, kdc, extraLine); Config.refresh(); Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); Set<KerberosTicket> tickets = c.s().getPrivateCredentials(KerberosTicket.class); if (tickets.isEmpty()) throw new Exception(); KerberosTicket ticket = tickets.iterator().next(); InetAddress[] addresses = ticket.getClientAddresses(); switch (args[0]) { case "1": if (addresses == null || addresses.length == 0) { throw new Exception("No addresses"); } if (ticket.getServer().getNameType() != KerberosPrincipal.KRB_NT_SRV_INST) { throw new Exception( "Wrong type: " + ticket.getServer().getNameType()); } break; default: if (addresses != null && addresses.length != 0) { throw new Exception("See addresses"); } break; } }