congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.apache.sentry.policy.common
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.sentry.policy.common

Best Java code snippets using org.apache.sentry.policy.common (Showing top 20 results out of 315)

origin: apache/incubator-sentry

 @Override
 public Privilege apply(String privilege) {
  return privilegeFactory.createPrivilege(privilege);
 }
});
origin: apache/incubator-sentry

public ResourceAuthorizationProvider(PolicyEngine policy,
  GroupMappingService groupService) {
 this.policy = policy;
 this.groupService = groupService;
 this.privilegeFactory = policy.getPrivilegeFactory();
}
origin: apache/incubator-sentry

@Override
public void validateResource(boolean strictValidation) throws SentryConfigurationException {
 policy.validatePolicy(strictValidation);
}
origin: apache/incubator-sentry

private boolean impliesKeyValue(KeyValue policyPart, KeyValue requestPart) {
 Preconditions.checkState(policyPart.getKey().equalsIgnoreCase(requestPart.getKey()),
   "Please report, this method should not be called with two different keys");
 if(policyPart.getValue().equals(IndexerConstants.ALL) || policyPart.equals(requestPart)) {
  return true;
 } else if (!PolicyConstants.PRIVILEGE_NAME.equalsIgnoreCase(policyPart.getKey())
   && IndexerConstants.ALL.equalsIgnoreCase(requestPart.getValue())) {
  /* privilege request is to match with any object of given type */
  return true;
 }
 return false;
}
origin: apache/incubator-sentry

 @Override
 public String toString() {
  StringBuilder sb = new StringBuilder();
  for(KeyValue kv: this.parts) {
   sb.append(kv.getKey() + "=" + kv.getValue() + "->");
  }
  return sb.toString();
 }
}
origin: co.cask.cdap/cdap-sentry-policy

/**
 * Gets a {@link Authorizable} from the given key and value
 *
 * @param key the {@link AuthorizableType type} of the authorizable
 * @param value the {@link Authorizable name} of the authorizable
 * @return the created {@link Authorizable} with the given name if {@link AuthorizableType} given was valid
 * @throws NoSuchElementException if the given {@link AuthorizableType} was not valid
 */
public static Authorizable from(String key, String value) {
 return from(new KeyValue(key, value));
}
origin: apache/incubator-sentry

 private static void validatePrivilegeHierarchy(String privilegeStr) throws Exception {
  List<PrivilegeValidator> validators = SimpleSearchPolicyEngine.createPrivilegeValidators();
  PrivilegeValidatorContext context = new PrivilegeValidatorContext(null, privilegeStr);
  for (PrivilegeValidator validator : validators) {
   try {
    validator.validate(context);
   } catch (ConfigurationException e) {
    throw new IllegalArgumentException(e);
   }
  }
 }
}
origin: apache/incubator-sentry

@Override
public Set<String> listPrivilegesForGroup(String groupName) throws SentryConfigurationException {
 return policy.getPrivileges(Sets.newHashSet(groupName), ActiveRoleSet.ALL);
}
origin: apache/sentry

 @Override
 public Privilege createPrivilege(String privilege) {
  return new CommonPrivilege(privilege);
 }
}
origin: apache/incubator-sentry

@Override
public void close() {
 if (policy != null) {
  policy.close();
 }
}
origin: apache/sentry

/**
 * Check if the action part in a privilege is ALL. Owner privilege is
 * treated as ALL for authorization
 * @param actionPart it must be the action of a privilege
 * @return true if the action is ALL; false otherwise
 */
private boolean isPrivilegeActionAll(KeyValue actionPart,
  BitFieldActionFactory bitFieldActionFactory) {
 return impliesAction(actionPart.getValue(), SentryConstants.PRIVILEGE_WILDCARD_VALUE,
   bitFieldActionFactory);
}
origin: apache/incubator-sentry

private boolean hasHostWidCard(KeyValue policyPart) {
 if (policyPart.getKey().equalsIgnoreCase(KafkaAuthorizable.AuthorizableType.HOST.toString()) &&
   policyPart.getValue().equalsIgnoreCase(ALL_HOSTS)) {
  return true;
 }
 return false;
}
origin: co.cask.cdap/cdap-sentry-policy

/**
 * Gets a {@link Authorizable} from the given {@link KeyValue}
 *
 * @param keyValue {@link KeyValue} containing the {@link AuthorizableType} and name of the {@link Authorizable}
 * to be crearted
 * @return the created {@link Authorizable} with the given name if {@link AuthorizableType} given was valid
 * @throws NoSuchElementException if the given {@link AuthorizableType} was not valid
 */
static Authorizable from(String keyValue) {
 return from(new KeyValue(keyValue));
}
origin: apache/incubator-sentry

@Override
public Set<String> listPrivilegesForSubject(Subject subject) throws SentryConfigurationException {
 return policy.getPrivileges(getGroups(subject), ActiveRoleSet.ALL);
}
origin: apache/incubator-sentry

public static SqoopAuthorizable from(String keyValue) {
 return from(new KeyValue(keyValue));
}
origin: apache/incubator-sentry

private Iterable<Privilege> getPrivileges(Set<String> groups, ActiveRoleSet roleSet, Authorizable[] authorizables) {
 return Iterables.transform(appendDefaultDBPriv(policy.getPrivileges(groups, roleSet, authorizables), authorizables),
   new Function<String, Privilege>() {
  @Override
  public Privilege apply(String privilege) {
   return privilegeFactory.createPrivilege(privilege);
  }
 });
}
origin: apache/incubator-sentry

public static KafkaAuthorizable from(String keyValue) throws ConfigurationException {
 return from(new KeyValue(keyValue));
}
origin: apache/incubator-sentry

public static IndexerModelAuthorizable from(String s) {
 return from(new KeyValue(s));
}
origin: apache/incubator-sentry

public static SearchModelAuthorizable from(String s) {
 return from(new KeyValue(s));
}
origin: apache/incubator-sentry

public static DBModelAuthorizable from(String s) {
 return from(new KeyValue(s));
}
org.apache.sentry.policy.common

Most used classes

  • PrivilegeValidatorContext
  • KeyValue
  • CommonPrivilege
  • PolicyEngine
  • PrivilegeValidator
  • PrivilegeFactory,
  • PrivilegeUtils
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