From e7de2a1f8e942941b964dd3a044a64f912b1f61f Mon Sep 17 00:00:00 2001 From: Jan Hentschel Date: Wed, 2 Dec 2015 09:46:34 +0100 Subject: [PATCH] [TACHYON-935] Added the usage of links in the documentation in the tachyon.security packages --- .../main/java/tachyon/security/LoginUser.java | 3 ++- .../AuthenticationProvider.java | 7 +++--- .../authentication/AuthenticationUtils.java | 15 +++++++------ .../CustomAuthenticationProviderImpl.java | 2 +- .../authentication/PlainSaslServer.java | 22 +++++++++---------- .../PlainSaslServerProvider.java | 6 ++--- .../authentication/PlainSaslUtils.java | 8 +++---- .../authorization/PermissionStatus.java | 3 ++- .../security/login/AppLoginModule.java | 2 +- .../login/TachyonJaasConfiguration.java | 9 ++++---- 10 files changed, 41 insertions(+), 36 deletions(-) diff --git a/common/src/main/java/tachyon/security/LoginUser.java b/common/src/main/java/tachyon/security/LoginUser.java index 0947a8f9298a..b6c700a79923 100644 --- a/common/src/main/java/tachyon/security/LoginUser.java +++ b/common/src/main/java/tachyon/security/LoginUser.java @@ -94,7 +94,8 @@ private static User login(TachyonConf conf) throws IOException { } /** - * Checks whether Tachyon is running in secure mode, such as SIMPLE, KERBEROS, CUSTOM. + * Checks whether Tachyon is running in secure mode, such as {@link AuthType#SIMPLE}, + * {@link AuthType#KERBEROS}, {@link AuthType#CUSTOM}. * * @param authType the authentication type in configuration */ diff --git a/common/src/main/java/tachyon/security/authentication/AuthenticationProvider.java b/common/src/main/java/tachyon/security/authentication/AuthenticationProvider.java index c3baec85863c..97b80847b31d 100644 --- a/common/src/main/java/tachyon/security/authentication/AuthenticationProvider.java +++ b/common/src/main/java/tachyon/security/authentication/AuthenticationProvider.java @@ -41,9 +41,10 @@ public static AuthenticationProvider getAuthenticationProvider(AuthType authType } /** - * The authenticate method is called by the PlainServerCallbackHandler in the PlainSaslServer - * layer to authenticate users for their requests. If a user is to be granted, return - * nothing/throw nothing. When a user is to be disallowed, throw an appropriate + * The authenticate method is called by the + * {@link tachyon.security.authentication.PlainSaslServer.PlainServerCallbackHandler} in the + * {@link PlainSaslServer} layer to authenticate users for their requests. If a user is to be + * granted, return nothing/throw nothing. When a user is to be disallowed, throw an appropriate * {@link AuthenticationException}. * * @param user The username received over the connection request diff --git a/common/src/main/java/tachyon/security/authentication/AuthenticationUtils.java b/common/src/main/java/tachyon/security/authentication/AuthenticationUtils.java index 9617f4b2999e..9920cdc62c6e 100644 --- a/common/src/main/java/tachyon/security/authentication/AuthenticationUtils.java +++ b/common/src/main/java/tachyon/security/authentication/AuthenticationUtils.java @@ -37,9 +37,9 @@ */ public final class AuthenticationUtils { /** - * For server side, this method returns a TTransportFactory based on the auth type. It is used as - * one argument to build a Thrift TServer. If the auth type is not supported or recognized, an - * UnsupportedOperationException is thrown. + * For server side, this method returns a {@link TTransportFactory} based on the auth type. It is + * used as one argument to build a Thrift {@link org.apache.thrift.server.TServer}. If the auth + * type is not supported or recognized, an {@link UnsupportedOperationException} is thrown. * * @param tachyonConf Tachyon Configuration * @return a corresponding TTransportFactory @@ -64,11 +64,12 @@ public static TTransportFactory getServerTransportFactory(TachyonConf tachyonCon } /** - * Creates a transport per the connection options. Supported transport options are: NOSASL, - * SIMPLE, CUSTOM, KERBEROS. With NOSASL as input, an unmodified TTransport is returned; with + * Creates a transport per the connection options. Supported transport options are: + * {@link AuthType#NOSASL}, {@link AuthType#SIMPLE}, {link@ AuthType#CUSTOM}, + * {@link AuthType#KERBEROS}. With NOSASL as input, an unmodified TTransport is returned; with * SIMPLE/CUSTOM as input, a PlainClientTransport is returned; KERBEROS is not supported - * currently. If the auth type is not supported or recognized, an UnsupportedOperationException is - * thrown. + * currently. If the auth type is not supported or recognized, an + * {@link UnsupportedOperationException} is thrown. * * @param tachyonConf Tachyon Configuration * @param serverAddress the server address which clients will connect to diff --git a/common/src/main/java/tachyon/security/authentication/CustomAuthenticationProviderImpl.java b/common/src/main/java/tachyon/security/authentication/CustomAuthenticationProviderImpl.java index 902f2ff7d19f..a11223a193fd 100644 --- a/common/src/main/java/tachyon/security/authentication/CustomAuthenticationProviderImpl.java +++ b/common/src/main/java/tachyon/security/authentication/CustomAuthenticationProviderImpl.java @@ -23,7 +23,7 @@ /** * An authentication provider implementation that allows {@link AuthenticationProvider} to be * customized at configuration time. This authentication provider is created if authentication type - * specified in {@link TachyonConf} is {@link AuthType#CUSTOM CUSTOM}. It requires the property + * specified in {@link TachyonConf} is {@link AuthType#CUSTOM}. It requires the property * {@code tachyon.security.authentication.custom.provider} to be set in {@link TachyonConf * Configuration} to determine which provider to load. */ diff --git a/common/src/main/java/tachyon/security/authentication/PlainSaslServer.java b/common/src/main/java/tachyon/security/authentication/PlainSaslServer.java index 0d884046a7c3..e986b3d2fed2 100644 --- a/common/src/main/java/tachyon/security/authentication/PlainSaslServer.java +++ b/common/src/main/java/tachyon/security/authentication/PlainSaslServer.java @@ -38,14 +38,14 @@ * provider needed to register to support server-side PLAIN mechanism. This class completes three * basic steps to implement a SASL security provider: *
    - *
  1. Write a class that implements the SaslServer interface
  2. - *
  3. Write a factory class implements the SaslServerFactory
  4. + *
  5. Write a class that implements the {@link SaslServer} interface
  6. + *
  7. Write a factory class implements the {@link javax.security.sasl.SaslServerFactory}
  8. *
  9. Write a JCA provider that registers the factory
  10. *
* - * NOTE: When this SaslServer works on authentication (i.e., in the method evaluateResponse()), it - * always assigns authentication ID to authorization ID currently. - * + * NOTE: When this SaslServer works on authentication (i.e., in the method + * {@link #evaluateResponse(byte[])}, it always assigns authentication ID to authorization ID + * currently. */ // TODO(dong): Authorization ID and authentication ID could be different after supporting // impersonation. @@ -168,7 +168,7 @@ private void checkNotComplete() { } /** - * PlainServerCallbackHandler is used by the SASL mechanisms to get further information to + * {@link PlainServerCallbackHandler} is used by the SASL mechanisms to get further information to * complete the authentication. For example, a SASL mechanism might use this callback handler to * do verification operation. */ @@ -213,7 +213,7 @@ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallback /** * An instance of this class represents a client user connecting to Tachyon service. * - * It is maintained in a ThreadLocal variable based on the Thrift RPC mechanism. + * It is maintained in a {@link ThreadLocal} variable based on the Thrift RPC mechanism. * {@link org.apache.thrift.server.TThreadPoolServer} allocates a thread to serve a connection * from client side and take back it when connection is closed. During the thread alive cycle, * all the RPC happens in this thread. These RPC methods implemented in server side could @@ -222,12 +222,12 @@ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallback public static final class AuthorizedClientUser { /** - * A ThreadLocal variable to maintain the client user along with a specific thread. + * A {@link ThreadLocal} variable to maintain the client user along with a specific thread. */ private static ThreadLocal sUserThreadLocal = new ThreadLocal(); /** - * Creates a {@link User} and sets it to the ThreadLocal variable. + * Creates a {@link User} and sets it to the {@link ThreadLocal} variable. * * @param userName the name of the client user */ @@ -236,7 +236,7 @@ public static void set(String userName) { } /** - * Gets the {@link User} from the ThreadLocal variable. + * Gets the {@link User} from the {@link ThreadLocal} variable. * * @return the client user */ @@ -245,7 +245,7 @@ public static User get() { } /** - * Removes the {@link User} from the ThreadLocal variable. + * Removes the {@link User} from the {@link ThreadLocal} variable. */ public static void remove() { sUserThreadLocal.remove(); diff --git a/common/src/main/java/tachyon/security/authentication/PlainSaslServerProvider.java b/common/src/main/java/tachyon/security/authentication/PlainSaslServerProvider.java index 11f7758ce631..a7e727561804 100644 --- a/common/src/main/java/tachyon/security/authentication/PlainSaslServerProvider.java +++ b/common/src/main/java/tachyon/security/authentication/PlainSaslServerProvider.java @@ -46,9 +46,9 @@ public PlainSaslServerProvider() { */ public static class PlainSaslServerFactory implements SaslServerFactory { /** - * Creates a SaslServer using the parameters supplied. It returns null if no SaslServer can be - * created using the parameters supplied. Throws SaslException if it cannot create a SaslServer - * because of an error. + * Creates a {@link SaslServer} using the parameters supplied. It returns null if no SaslServer + * can be created using the parameters supplied. Throws {@link SaslException} if it cannot + * create a SaslServer because of an error. * * @param mechanism the name of a SASL mechanism. (e.g. "PLAIN") * @param protocol the non-null string name of the protocol for which the authentication is diff --git a/common/src/main/java/tachyon/security/authentication/PlainSaslUtils.java b/common/src/main/java/tachyon/security/authentication/PlainSaslUtils.java index a59fc4104d58..a95e13bf3483 100644 --- a/common/src/main/java/tachyon/security/authentication/PlainSaslUtils.java +++ b/common/src/main/java/tachyon/security/authentication/PlainSaslUtils.java @@ -52,13 +52,13 @@ public static boolean isPlainSaslProviderAdded() { } /** - * For server side, get a PLAIN mechanism TTransportFactory. A callback handler is hooked for - * specific authentication methods. + * For server side, get a PLAIN mechanism {@link TTransportFactory}. A callback handler is hooked + * for specific authentication methods. * * @param authType the authentication type - * @param conf TachyonConf + * @param conf {@link TachyonConf} * @return a corresponding TTransportFactory, which is PLAIN mechanism - * @throws SaslException if an AuthenticationProvider is not found + * @throws SaslException if an {@link AuthenticationProvider} is not found */ public static TTransportFactory getPlainServerTransportFactory(AuthType authType, TachyonConf conf) throws SaslException { diff --git a/common/src/main/java/tachyon/security/authorization/PermissionStatus.java b/common/src/main/java/tachyon/security/authorization/PermissionStatus.java index c7fab55c1911..01a0d7773455 100644 --- a/common/src/main/java/tachyon/security/authorization/PermissionStatus.java +++ b/common/src/main/java/tachyon/security/authorization/PermissionStatus.java @@ -90,7 +90,8 @@ public PermissionStatus applyUMask(FileSystemPermission umask) { } /** - * Gets the Directory default PermissionStatus. Currently the default dir permission is 0777. + * Gets the Directory default {@link PermissionStatus}. Currently the default dir permission is + * 0777. * * @return the default {@link PermissionStatus} for directories */ diff --git a/common/src/main/java/tachyon/security/login/AppLoginModule.java b/common/src/main/java/tachyon/security/login/AppLoginModule.java index 2b17439ab909..a98a9ffb2a26 100644 --- a/common/src/main/java/tachyon/security/login/AppLoginModule.java +++ b/common/src/main/java/tachyon/security/login/AppLoginModule.java @@ -43,7 +43,7 @@ public void initialize(Subject subject, CallbackHandler callbackHandler, } /** - * Retrieves the user name by querying the property of Constants.SECURITY_LOGIN_USERNAME. + * Retrieves the user name by querying the property of {@link Constants#SECURITY_LOGIN_USERNAME}. * * @return true if user name provided by application is set and not empty * @throws javax.security.auth.login.LoginException diff --git a/common/src/main/java/tachyon/security/login/TachyonJaasConfiguration.java b/common/src/main/java/tachyon/security/login/TachyonJaasConfiguration.java index 130d26a2b65e..5bf64eec3a0a 100644 --- a/common/src/main/java/tachyon/security/login/TachyonJaasConfiguration.java +++ b/common/src/main/java/tachyon/security/login/TachyonJaasConfiguration.java @@ -54,11 +54,12 @@ public final class TachyonJaasConfiguration extends Configuration { // private static final AppConfigurationEntry KERBEROS_LOGIN = ... /** - * In SIMPLE mode, JAAS first tries to retrieve the user name set by the application with - * {@link tachyon.security.login.AppLoginModule}. Upon failure, it uses the OS specific login - * module to fetch the OS user, and then uses the + * In {@link AuthType#SIMPLE} mode, JAAS first tries to retrieve the user name set by the + * application with {@link tachyon.security.login.AppLoginModule}. Upon failure, it uses the OS + * specific login module to fetch the OS user, and then uses the * {@link tachyon.security.login .TachyonLoginModule} to convert it to a Tachyon user represented - * by {@link tachyon.security.User}. In CUSTOM mode, we also use this configuration. + * by {@link tachyon.security.User}. In {@link AuthType#CUSTOM} mode, we also use this + * configuration. */ private static final AppConfigurationEntry[] SIMPLE = new AppConfigurationEntry[] {APP_LOGIN, OS_SPECIFIC_LOGIN, TACHYON_LOGIN};