Class ExpAsStringVisibilityLabelServiceImpl

java.lang.Object
org.apache.hadoop.hbase.security.visibility.ExpAsStringVisibilityLabelServiceImpl
All Implemented Interfaces:
org.apache.hadoop.conf.Configurable, org.apache.hadoop.hbase.security.visibility.VisibilityLabelService

@Private public class ExpAsStringVisibilityLabelServiceImpl extends Object implements org.apache.hadoop.hbase.security.visibility.VisibilityLabelService
This is a VisibilityLabelService where labels in Mutation's visibility expression will be persisted as Strings itself rather than ordinals in 'labels' table. Also there is no need to add labels to the system, prior to using them in Mutations/Authorizations.
  • Field Details

  • Constructor Details

  • Method Details

    • addLabels

      public org.apache.hadoop.hbase.regionserver.OperationStatus[] addLabels(List<byte[]> labels) throws IOException
      Specified by:
      addLabels in interface org.apache.hadoop.hbase.security.visibility.VisibilityLabelService
      Throws:
      IOException
    • setAuths

      public org.apache.hadoop.hbase.regionserver.OperationStatus[] setAuths(byte[] user, List<byte[]> authLabels) throws IOException
      Specified by:
      setAuths in interface org.apache.hadoop.hbase.security.visibility.VisibilityLabelService
      Throws:
      IOException
    • clearAuths

      public org.apache.hadoop.hbase.regionserver.OperationStatus[] clearAuths(byte[] user, List<byte[]> authLabels) throws IOException
      Specified by:
      clearAuths in interface org.apache.hadoop.hbase.security.visibility.VisibilityLabelService
      Throws:
      IOException
    • getUserAuths

      public List<String> getUserAuths(byte[] user, boolean systemCall) throws IOException
      Specified by:
      getUserAuths in interface org.apache.hadoop.hbase.security.visibility.VisibilityLabelService
      Throws:
      IOException
    • getGroupAuths

      public List<String> getGroupAuths(String[] groups, boolean systemCall) throws IOException
      Specified by:
      getGroupAuths in interface org.apache.hadoop.hbase.security.visibility.VisibilityLabelService
      Throws:
      IOException
    • getAuths

      private void getAuths(org.apache.hadoop.hbase.client.Get get, List<String> auths) throws IOException
      Throws:
      IOException
    • listLabels

      public List<String> listLabels(String regex) throws IOException
      Specified by:
      listLabels in interface org.apache.hadoop.hbase.security.visibility.VisibilityLabelService
      Throws:
      IOException
    • createVisibilityExpTags

      public List<org.apache.hadoop.hbase.Tag> createVisibilityExpTags(String visExpression, boolean withSerializationFormat, boolean checkAuths) throws IOException
      Specified by:
      createVisibilityExpTags in interface org.apache.hadoop.hbase.security.visibility.VisibilityLabelService
      Throws:
      IOException
    • getVisibilityExpEvaluator

      public org.apache.hadoop.hbase.security.visibility.VisibilityExpEvaluator getVisibilityExpEvaluator(org.apache.hadoop.hbase.security.visibility.Authorizations authorizations) throws IOException
      Specified by:
      getVisibilityExpEvaluator in interface org.apache.hadoop.hbase.security.visibility.VisibilityLabelService
      Throws:
      IOException
    • isReadFromSystemAuthUser

      protected boolean isReadFromSystemAuthUser() throws IOException
      Throws:
      IOException
    • createTag

      private org.apache.hadoop.hbase.Tag createTag(org.apache.hadoop.hbase.security.visibility.expression.ExpressionNode node) throws IOException
      Throws:
      IOException
    • extractLabels

      private void extractLabels(org.apache.hadoop.hbase.security.visibility.expression.ExpressionNode node, List<String> labels, List<String> notLabels)
    • getConf

      public org.apache.hadoop.conf.Configuration getConf()
      Specified by:
      getConf in interface org.apache.hadoop.conf.Configurable
    • setConf

      public void setConf(org.apache.hadoop.conf.Configuration conf)
      Specified by:
      setConf in interface org.apache.hadoop.conf.Configurable
    • init

      public void init(org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment e) throws IOException
      Specified by:
      init in interface org.apache.hadoop.hbase.security.visibility.VisibilityLabelService
      Throws:
      IOException
    • havingSystemAuth

      public boolean havingSystemAuth(org.apache.hadoop.hbase.security.User user) throws IOException
      Specified by:
      havingSystemAuth in interface org.apache.hadoop.hbase.security.visibility.VisibilityLabelService
      Throws:
      IOException
    • matchVisibility

      public boolean matchVisibility(List<org.apache.hadoop.hbase.Tag> putTags, Byte putTagsFormat, List<org.apache.hadoop.hbase.Tag> deleteTags, Byte deleteTagsFormat) throws IOException
      Specified by:
      matchVisibility in interface org.apache.hadoop.hbase.security.visibility.VisibilityLabelService
      Throws:
      IOException
    • checkForMatchingVisibilityTagsWithSortedOrder

      private static boolean checkForMatchingVisibilityTagsWithSortedOrder(List<org.apache.hadoop.hbase.Tag> putVisTags, List<org.apache.hadoop.hbase.Tag> deleteVisTags)
    • encodeVisibilityForReplication

      public byte[] encodeVisibilityForReplication(List<org.apache.hadoop.hbase.Tag> tags, Byte serializationFormat) throws IOException
      Specified by:
      encodeVisibilityForReplication in interface org.apache.hadoop.hbase.security.visibility.VisibilityLabelService
      Throws:
      IOException
    • createModifiedVisExpression

      private byte[] createModifiedVisExpression(List<org.apache.hadoop.hbase.Tag> tags) throws IOException
      Parameters:
      tags - - all the tags associated with the current Cell
      Returns:
      - the modified visibility expression as byte[]
      Throws:
      IOException
    • getTagValuePartAsShort

      private static short getTagValuePartAsShort(org.apache.hadoop.hbase.Tag t, int offset)
    • getTagValuePartAsString

      private static String getTagValuePartAsString(org.apache.hadoop.hbase.Tag t, int offset, int length)