public class KerberosUtil extends Object
| Constructor and Description |
|---|
KerberosUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getDefaultRealm() |
static String |
getDefaultRealmProtected() |
static String |
getDomainRealm(String shortprinc) |
static String |
getKrb5LoginModuleName() |
static Oid |
getOidInstance(String oidName) |
static String[] |
getPrincipalNames(String keytab,
Pattern pattern)
Get all the unique principals from keytabfile which matches a pattern.
|
static String |
getServicePrincipal(String service,
String hostname)
Create Kerberos principal for a given service and hostname,
inferring realm from the fqdn of the hostname.
|
static boolean |
hasKerberosKeyTab(Subject subject)
Check if the subject contains Kerberos keytab related objects.
|
static boolean |
hasKerberosTicket(Subject subject)
Check if the subject contains Kerberos ticket.
|
public static String getKrb5LoginModuleName()
public static Oid getOidInstance(String oidName) throws ClassNotFoundException, GSSException, NoSuchFieldException, IllegalAccessException
public static String getDefaultRealm() throws ClassNotFoundException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
public static String getDefaultRealmProtected()
public static final String getServicePrincipal(String service, String hostname) throws UnknownHostException
service - Service for which you want to generate the principal.hostname - Fully-qualified domain name.UnknownHostException - If no IP address for the local host could be found.public static final String[] getPrincipalNames(String keytab, Pattern pattern) throws IOException
keytab - Name of the keytab file to be read.pattern - pattern to be matched.IOException - if cannot get the principal namepublic static boolean hasKerberosKeyTab(Subject subject)
subject - subject to be checkedpublic static boolean hasKerberosTicket(Subject subject)
subject - subject to be checkedCopyright © 2017 Apache Software Foundation. All Rights Reserved.