Tabnine Logo
SecurityUtils.isAuthenticationEnabled
Code IndexAdd Tabnine to your IDE (free)

How to use
isAuthenticationEnabled
method
in
alluxio.util.SecurityUtils

Best Java code snippets using alluxio.util.SecurityUtils.isAuthenticationEnabled (Showing top 13 results out of 315)

origin: Alluxio/alluxio

/**
 * Checks if security is enabled.
 *
 * @param conf Alluxio configuration
 * @return true if security is enabled, false otherwise
 */
public static boolean isSecurityEnabled(AlluxioConfiguration conf) {
 return isAuthenticationEnabled(conf) && isAuthorizationEnabled(conf);
}
origin: Alluxio/alluxio

/**
 * Gets the {@link User} from the {@link ThreadLocal} variable.
 *
 * @param conf Alluxio configuration
 * @return the client user, null if the user is not present
 */
// TODO(peis): Fail early if the user is not able to be set to avoid returning null.
public static User get(AlluxioConfiguration conf) throws IOException {
 if (!SecurityUtils.isAuthenticationEnabled(conf)) {
  throw new IOException(ExceptionMessage.AUTHENTICATION_IS_NOT_ENABLED.getMessage());
 }
 return sUserThreadLocal.get();
}
origin: Alluxio/alluxio

private GrpcServerBuilder(NettyServerBuilder nettyServerBuilder, AlluxioConfiguration conf) {
 mConfiguration = conf;
 mServices = new HashSet<>();
 mNettyServerBuilder = nettyServerBuilder;
 if (SecurityUtils.isAuthenticationEnabled(conf)) {
  LoggerFactory.getLogger(GrpcServerBuilder.class).warn("Authentication ENABLED");
  mAuthenticationServer = new DefaultAuthenticationServer(conf);
  addService(new GrpcService(mAuthenticationServer).disableAuthentication());
 }
}
origin: Alluxio/alluxio

/**
 * Add a service to this server.
 *
 * @param serviceDefinition the service definition of new service
 * @return an updated instance of this {@link GrpcServerBuilder}
 */
public GrpcServerBuilder addService(GrpcService serviceDefinition) {
 ServerServiceDefinition service = serviceDefinition.getServiceDefinition();
 if (SecurityUtils.isAuthenticationEnabled(mConfiguration) && serviceDefinition.isAuthenticated()) {
  service = ServerInterceptors.intercept(service, mAuthenticationServer.getInterceptors());
 }
 mNettyServerBuilder = mNettyServerBuilder.addService(service);
 return this;
}
origin: Alluxio/alluxio

private String getQualifiedMetricName(String metricName) {
 try {
  if (SecurityUtils.isAuthenticationEnabled(mContext.getConf())
    && LoginUser.get(mContext.getConf()) != null) {
   return Metric.getMetricNameWithTags(metricName, CommonMetrics.TAG_USER,
     LoginUser.get(mContext.getConf()).getName());
  } else {
   return metricName;
  }
 } catch (IOException e) {
  return metricName;
 }
}
origin: Alluxio/alluxio

/**
 * Creates context with given option data.
 *
 * @param optionsBuilder the options builder
 */
protected CreatePathContext(T optionsBuilder) {
 super(optionsBuilder);
 mMountPoint = false;
 mOperationTimeMs = System.currentTimeMillis();
 mAcl = Collections.emptyList();
 mMetadataLoad = false;
 mGroup = "";
 mOwner = "";
 if (SecurityUtils.isAuthenticationEnabled(ServerConfiguration.global())) {
  mOwner = SecurityUtils.getOwnerFromGrpcClient(ServerConfiguration.global());
  mGroup = SecurityUtils.getGroupFromGrpcClient(ServerConfiguration.global());
 }
 // Initialize mPersisted based on proto write type.
 WritePType writeType = WritePType.NONE;
 if (optionsBuilder instanceof CreateFilePOptions.Builder) {
  writeType = ((CreateFilePOptions.Builder) optionsBuilder).getWriteType();
 } else if (optionsBuilder instanceof CreateDirectoryPOptions.Builder) {
  writeType = ((CreateDirectoryPOptions.Builder) optionsBuilder).getWriteType();
 }
 mPersisted = WriteType.fromProto(writeType).isThrough();
}
origin: Alluxio/alluxio

private String getQualifiedMetricName(String metricName) {
 try {
  if (SecurityUtils.isAuthenticationEnabled(mConfiguration)
    && AuthenticatedClientUser.get(mConfiguration) != null) {
   return Metric.getMetricNameWithTags(metricName, CommonMetrics.TAG_USER,
     AuthenticatedClientUser.get(mConfiguration).getName(), WorkerMetrics.TAG_UFS,
     MetricsSystem.escape(new AlluxioURI(mPath)), WorkerMetrics.TAG_UFS_TYPE,
     mUnderFileSystem.getUnderFSType());
  }
 } catch (IOException e) {
  // fall through
 }
 return Metric.getMetricNameWithTags(metricName, WorkerMetrics.TAG_UFS,
   MetricsSystem.escape(new AlluxioURI(mPath)), WorkerMetrics.TAG_UFS_TYPE,
   mUnderFileSystem.getUnderFSType());
}
origin: org.alluxio/alluxio-core-common

/**
 * Gets the {@link User} from the {@link ThreadLocal} variable.
 *
 * @return the client user, null if the user is not present
 */
// TODO(peis): Fail early if the user is not able to be set to avoid returning null.
public static User get() throws IOException {
 if (!SecurityUtils.isAuthenticationEnabled()) {
  throw new IOException(ExceptionMessage.AUTHENTICATION_IS_NOT_ENABLED.getMessage());
 }
 return sUserThreadLocal.get();
}
origin: org.alluxio/alluxio-core-common

/**
 * Checks if security is enabled.
 *
 * @return true if security is enabled, false otherwise
 */
public static boolean isSecurityEnabled() {
 return isAuthenticationEnabled() && isAuthorizationEnabled();
}
origin: org.alluxio/alluxio-core-common

private String getQualifiedMetricName(String metricName) {
 try {
  if (SecurityUtils.isAuthenticationEnabled() && LoginUser.get() != null) {
   return Metric.getMetricNameWithTags(metricName, CommonMetrics.TAG_USER, LoginUser.get()
     .getName());
  } else {
   return metricName;
  }
 } catch (IOException e) {
  return metricName;
 }
}
origin: org.alluxio/alluxio-core-common

private String getQualifiedMetricName(String metricName) {
 try {
  if (SecurityUtils.isAuthenticationEnabled() && AuthenticatedClientUser.get() != null) {
   return Metric.getMetricNameWithTags(metricName, CommonMetrics.TAG_USER,
     AuthenticatedClientUser.get().getName(), WorkerMetrics.TAG_UFS,
     MetricsSystem.escape(new AlluxioURI(mPath)), WorkerMetrics.TAG_UFS_TYPE,
     mUnderFileSystem.getUnderFSType());
  }
 } catch (IOException e) {
  // fall through
 }
 return Metric.getMetricNameWithTags(metricName, WorkerMetrics.TAG_UFS,
   MetricsSystem.escape(new AlluxioURI(mPath)), WorkerMetrics.TAG_UFS_TYPE,
   mUnderFileSystem.getUnderFSType());
}
origin: org.alluxio/alluxio-core-server-master

/**
 * Constructs an instance of {@link CreateFileOptions} from {@link CreateFileTOptions}. The option
 * of permission is constructed with the username obtained from thrift transport.
 *
 * @param options the {@link CreateFileTOptions} to use
 */
public CreateFileOptions(CreateFileTOptions options) {
 this();
 if (options != null) {
  if (options.isSetCommonOptions()) {
   mCommonOptions = new CommonOptions(options.getCommonOptions());
  }
  mBlockSizeBytes = options.getBlockSizeBytes();
  mPersisted = options.isPersisted();
  mRecursive = options.isRecursive();
  mTtl = options.getTtl();
  mTtlAction = TtlAction.fromThrift(options.getTtlAction());
  if (SecurityUtils.isAuthenticationEnabled()) {
   mOwner = SecurityUtils.getOwnerFromThriftClient();
   mGroup = SecurityUtils.getGroupFromThriftClient();
  }
  if (options.isSetMode()) {
   mMode = new Mode(options.getMode());
  } else {
   mMode.applyFileUMask();
  }
 }
}
origin: org.alluxio/alluxio-core-server-master

/**
 * Constructs an instance of {@link CreateDirectoryOptions} from {@link CreateDirectoryTOptions}.
 * The option of permission is constructed with the username obtained from thrift
 * transport.
 *
 * @param options the {@link CreateDirectoryTOptions} to use
 */
public CreateDirectoryOptions(CreateDirectoryTOptions options) {
 this();
 if (options != null) {
  if (options.isSetCommonOptions()) {
   mCommonOptions = new CommonOptions(options.getCommonOptions());
  }
  mAllowExists = options.isAllowExists();
  mPersisted = options.isPersisted();
  mRecursive = options.isRecursive();
  mTtl = options.getTtl();
  mTtlAction = TtlAction.fromThrift(options.getTtlAction());
  if (SecurityUtils.isAuthenticationEnabled()) {
   mOwner = SecurityUtils.getOwnerFromThriftClient();
   mGroup = SecurityUtils.getGroupFromThriftClient();
  }
  if (options.isSetMode()) {
   mMode = new Mode(options.getMode());
  } else {
   mMode.applyDirectoryUMask();
  }
 }
}
alluxio.utilSecurityUtilsisAuthenticationEnabled

Javadoc

Checks if authentication is enabled.

Popular methods of SecurityUtils

  • isSecurityEnabled
    Checks if security is enabled.
  • getGroupFromGrpcClient
  • getGroupFromLoginModule
  • getOwnerFromGrpcClient
  • getOwnerFromLoginModule
  • getGroupFromThriftClient
  • getOwnerFromThriftClient
  • isAuthorizationEnabled
    Checks if authorization is enabled.

Popular in Java

  • Running tasks concurrently on multiple threads
  • startActivity (Activity)
  • getExternalFilesDir (Context)
  • findViewById (Activity)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now