diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/KerberosTestCase.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/KerberosTestCase.java index 891f400c7be60..cad9f689d3d5c 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/KerberosTestCase.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/KerberosTestCase.java @@ -133,7 +133,7 @@ public void tearDownMiniKdc() throws IOException, PrivilegedActionException { * @param dir Directory where the key tab would be created. * @param princNames principal names to be created * @return {@link Path} to key tab file. - * @throws Exception + * @throws Exception thrown if principal or keytab could not be created */ protected Path createPrincipalKeyTab(final Path dir, final String... princNames) throws Exception { final Path path = dir.resolve(randomAlphaOfLength(10) + ".keytab"); @@ -146,7 +146,7 @@ protected Path createPrincipalKeyTab(final Path dir, final String... princNames) * * @param principalName Principal name * @param password Password - * @throws Exception + * @throws Exception thrown if principal could not be created */ protected void createPrincipal(final String principalName, final char[] password) throws Exception { simpleKdcLdapServer.createPrincipal(principalName, new String(password)); @@ -168,8 +168,8 @@ protected String principalName(final String user) { * @param subject {@link Subject} * @param action {@link PrivilegedExceptionAction} action for performing inside * Subject.doAs - * @return Type of value as returned by PrivilegedAction - * @throws PrivilegedActionException + * @return T Type of value as returned by PrivilegedAction + * @throws PrivilegedActionException when privileged action threw exception */ static T doAsWrapper(final Subject subject, final PrivilegedExceptionAction action) throws PrivilegedActionException { return AccessController.doPrivileged((PrivilegedExceptionAction) () -> Subject.doAs(subject, action)); @@ -181,7 +181,7 @@ static T doAsWrapper(final Subject subject, final PrivilegedExceptionAction< * @param keytabPath {@link Path} to keytab file. * @param content Content for keytab * @return key tab path - * @throws IOException + * @throws IOException if I/O error occurs while writing keytab file */ public static Path writeKeyTab(final Path keytabPath, final String content) throws IOException { try (BufferedWriter bufferedWriter = Files.newBufferedWriter(keytabPath, StandardCharsets.US_ASCII)) { diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/SimpleKdcLdapServer.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/SimpleKdcLdapServer.java index 426cacb1a034c..53bf9e2b78d0b 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/SimpleKdcLdapServer.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/SimpleKdcLdapServer.java @@ -66,7 +66,7 @@ public class SimpleKdcLdapServer { * @param orgName Org name for base dn * @param domainName domain name for base dn * @param ldiff for ldap directory. - * @throws Exception + * @throws Exception when KDC or Ldap server initialization fails */ public SimpleKdcLdapServer(final Path workDir, final String orgName, final String domainName, final Path ldiff) throws Exception { this.workDir = workDir; @@ -194,7 +194,7 @@ public synchronized void createPrincipal(final Path keytabFile, final String... /** * Stop Simple Kdc Server * - * @throws PrivilegedActionException + * @throws PrivilegedActionException when privileged action threw exception */ public synchronized void stop() throws PrivilegedActionException { AccessController.doPrivileged(new PrivilegedExceptionAction() { diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/SpnegoClient.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/SpnegoClient.java index 1f883b928bd97..7fcca3d9f5806 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/SpnegoClient.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/kerberos/SpnegoClient.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.logging.ESLoggerFactory; import org.elasticsearch.common.settings.SecureString; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.xpack.security.authc.kerberos.KerberosTicketValidator; import org.ietf.jgss.GSSContext; import org.ietf.jgss.GSSCredential; @@ -67,8 +66,8 @@ class SpnegoClient implements AutoCloseable { * @param password password for client * @param servicePrincipalName Service principal name with whom this client * interacts with. - * @throws PrivilegedActionException - * @throws GSSException + * @throws PrivilegedActionException when privileged action threw exception + * @throws GSSException thrown when GSS API error occurs */ SpnegoClient(final String userPrincipalName, final SecureString password, final String servicePrincipalName) throws PrivilegedActionException, GSSException { @@ -99,7 +98,7 @@ class SpnegoClient implements AutoCloseable { * base64 encoded token to be sent to server. * * @return Base64 encoded token - * @throws PrivilegedActionException + * @throws PrivilegedActionException when privileged action threw exception */ String getBase64EncodedTokenForSpnegoHeader() throws PrivilegedActionException { final byte[] outToken = KerberosTestCase.doAsWrapper(loginContext.getSubject(), @@ -114,7 +113,7 @@ String getBase64EncodedTokenForSpnegoHeader() throws PrivilegedActionException { * gss negotiation * @return Base64 encoded token to be sent to server. May return {@code null} if * nothing to be sent. - * @throws PrivilegedActionException + * @throws PrivilegedActionException when privileged action threw exception */ String handleResponse(final String base64Token) throws PrivilegedActionException { if (gssContext.isEstablished()) { @@ -160,10 +159,9 @@ boolean isEstablished() { * * @param principal Principal name * @param password {@link SecureString} - * @param settings {@link Settings} * @return authenticated {@link LoginContext} instance. Note: This needs to be * closed {@link LoginContext#logout()} after usage. - * @throws LoginException + * @throws LoginException thrown if problem with login configuration or when login fails */ private static LoginContext loginUsingPassword(final String principal, final SecureString password) throws LoginException { final Set principals = Collections.singleton(new KerberosPrincipal(principal)); @@ -182,8 +180,8 @@ private static LoginContext loginUsingPassword(final String principal, final Sec * Instead of an additional file setting as we do not want the options to be * customizable we are constructing it in memory. *

- * As we are uing this instead of jaas.conf, this requires refresh of - * {@link Configuration} and reqires appropriate security permissions to do so. + * As we are using this instead of jaas.conf, this requires refresh of + * {@link Configuration} and requires appropriate security permissions to do so. */ static class PasswordJaasConf extends Configuration { private final String principal;