A Kerberos JAAS login module that obtains long term secret keys from a
keytab file should use this class. The login module will store
an instance of this class in the private credential set of a
Subject during the commit phase of the
authentication process.
If a KeyTab object is obtained from getUnboundInstance()
or getUnboundInstance(java., it is unbound and thus can be
used by any service principal. Otherwise, if it's obtained from
getInstance(KerberosPrincipal) or
getInstance(KerberosPrincipal, java., it is bound to the
specific service principal and can only be used by it.
Please note the constructors getInstance() and
getInstance(java. were created when there was no support
for unbound keytabs. These methods should not be used anymore. An object
created with either of these methods are considered to be bound to an
unknown principal, which means, its isBound() returns true and
getPrincipal() returns null.
The keytab file format is described at http://www.ioplex.com/utilities/keytab.txt.
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final File | |
| private final KerberosPrincipal |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the specified object is equal to thisKeyTabthe object to compare to other)Overrides java. Compares the specified object with this |
| public boolean | |
| pack-priv EncryptionKey[] | |
| public static KeyTab | Returns: the keytab instancethe keytab file)File object, must not be nullReturns a |
| public static KeyTab | Returns: the keytab instancethe bound service principal, must not be null princ, File the keytab file)File object, must not be nullReturns a |
| public static KeyTab | Returns: the default keytab instance.Returns the default |
| public static KeyTab | Returns: the default keytab instancethe bound service principal, must not be null princ)Returns the default |
| public KerberosKey[] | Returns: the keys (never null, may be empty)the Kerberos principal, must not be null. principal)Returns fresh keys for the given Kerberos principal. |
| public KerberosPrincipal | Returns: the service principalReturns the service principal this |
| public static KeyTab | Returns: the keytab instancethe keytab file)File object, must not be nullReturns an unbound |
| public static KeyTab | Returns: the default keytab instanceReturns the default unbound |
| public int | Returns: a hash code for thisKeyTabOverrides java. Returns a hash code for this |
| public boolean | Returns: if the keytab is bound to a principalReturns if the keytab is bound to a principal |
| pack-priv KeyTab | |
| public String | Returns: an informative textual representation of thisKeyTab.Overrides java. Returns an informative textual representation of this |
| bound | back to summary |
|---|---|
| private final boolean bound | |
| file | back to summary |
|---|---|
| private final File file | |
| princ | back to summary |
|---|---|
| private final KerberosPrincipal princ | |
| KeyTab | back to summary |
|---|---|
| private KeyTab(KerberosPrincipal princ, File file, boolean bound) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Compares the specified object with this | |
| exists | back to summary |
|---|---|
| public boolean exists() Checks if the keytab file exists. Implementation of this method should make sure that the result matches the latest status of the keytab file.
| |
| getEncryptionKeys | back to summary |
|---|---|
| pack-priv EncryptionKey[] getEncryptionKeys(PrincipalName principal) | |
| getInstance | back to summary |
|---|---|
| public static KeyTab getInstance(File file) Returns a
The result of this method is never null. This method only associates
the returned
Developers should call
| |
| getInstance | back to summary |
|---|---|
| public static KeyTab getInstance(KerberosPrincipal princ, File file) Returns a
The result of this method is never null. This method only associates
the returned
| |
| getInstance | back to summary |
|---|---|
| public static KeyTab getInstance() Returns the default
The result of this method is never null. This method only associates
the returned
Developers should call
| |
| getInstance | back to summary |
|---|---|
| public static KeyTab getInstance(KerberosPrincipal princ) Returns the default
The result of this method is never null. This method only associates
the returned
| |
| getKeys | back to summary |
|---|---|
| public KerberosKey[] getKeys(KerberosPrincipal principal) Returns fresh keys for the given Kerberos principal.
Implementation of this method should make sure the returned keys match
the latest content of the keytab file. The result is a newly created
copy that can be modified by the caller without modifying the keytab
object. The caller should
Please note that the keytab file can be created after the
If there is any error (say, I/O error or format error) during the reading process of the keytab file, a saved result should be returned. If there is no saved result (say, this is the first time this method is called, or, all previous read attempts failed), an empty array should be returned. This can make sure the result is not drastically changed during the (probably slow) update of the keytab file.
Each time this method is called and the reading of the file succeeds
with no exception (say, I/O error or file format error),
the result should be saved for Any unsupported key read from the keytab is ignored and not included in the result. If this keytab is bound to a specific principal, calling this method on another principal will return an empty array.
| |
| getPrincipal | back to summary |
|---|---|
| public KerberosPrincipal getPrincipal() Returns the service principal this
Please note the deprecated constructors create a
| |
| getUnboundInstance | back to summary |
|---|---|
| public static KeyTab getUnboundInstance(File file) Returns an unbound
The result of this method is never null. This method only associates
the returned
| |
| getUnboundInstance | back to summary |
|---|---|
| public static KeyTab getUnboundInstance() Returns the default unbound
The result of this method is never null. This method only associates
the returned
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Returns a hash code for this
| |
| isBound | back to summary |
|---|---|
| public boolean isBound() Returns if the keytab is bound to a principal
| |
| takeSnapshot | back to summary |
|---|---|
| pack-priv KeyTab takeSnapshot() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns an informative textual representation of this
| |