Tabnine Logo
Subject.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.apache.sentry.core.common.Subject
constructor

Best Java code snippets using org.apache.sentry.core.common.Subject.<init> (Showing top 14 results out of 315)

origin: apache/incubator-sentry

private Subject getCurrentSubject(HiveSemanticAnalyzerHookContext context) {
 // Extract the username from the hook context
 return new Subject(context.getUserName());
}
origin: apache/incubator-sentry

public SqoopAuthBinding(Configuration authConf, String serverName) throws Exception {
 this.authConf = authConf;
 this.authConf.set(AuthzConfVars.AUTHZ_SERVER_NAME.getVar(), serverName);
 this.sqoopServer = new Server(serverName);
 this.authProvider = createAuthProvider();
 /** The Sqoop server principal will use the binding */
 this.bindingSubject = new Subject(UserGroupInformation.getCurrentUser()
   .getShortUserName());
}
origin: apache/incubator-sentry

public SolrAuthzBinding (SolrAuthzConf authzConf) throws Exception {
 this.authzConf = addHdfsPropsToConf(authzConf);
 this.authProvider = getAuthProvider();
 this.groupMapping = authProvider.getGroupMapping();
 /**
  * The Solr server principal will use the binding
  */
 this.bindingSubject = new Subject(UserGroupInformation.getCurrentUser()
   .getShortUserName());
}
origin: apache/incubator-sentry

private Subject getSubject() {
 return new Subject(SentryAuthorizationHander.getAuthenticator().getUserName());
}
origin: apache/incubator-sentry

public void listPrivs() throws Exception {
 getSentryProvider().validateResource(true);
 System.out.println("Available privileges for user " + getUser() + ":");
 Set<String> permList = getSentryProvider().listPrivilegesForSubject(
   new Subject(getUser()));
 for (String perms : permList) {
  System.out.println("\t" + perms);
 }
 if (permList.isEmpty()) {
  System.out.println("\t*** No permissions available ***");
 }
}
origin: apache/incubator-sentry

/**
 * Authorize access to a Kafka privilege
 */
public boolean authorize(RequestChannel.Session session, Operation operation, Resource resource) {
  List<Authorizable> authorizables = ConvertUtil.convertResourceToAuthorizable(session.clientAddress().getHostAddress(), resource);
  Set<KafkaAction> actions = Sets.newHashSet(actionFactory.getActionByName(operation.name()));
  return authProvider.hasAccess(new Subject(getName(session)), authorizables, actions, ActiveRoleSet.ALL);
}
origin: com.ngdata/hbase-indexer-server

private Subject getSubject(SecurityContext securityContext)
throws SentryUserException {
 String princ = securityContext.getUserPrincipal() != null ?
  securityContext.getUserPrincipal().getName() : null;
 KerberosName kerbName = new KerberosName(princ);
 try {
  return new Subject(kerbName.getShortName());
 } catch (IOException e) {
  throw new SentryUserException("Unable to get subject", e);
 }
}
origin: apache/incubator-sentry

   throws SemanticException {
List<FieldSchema> filteredResult = new ArrayList<FieldSchema>();
Subject subject = new Subject(userName);
HiveAuthzPrivileges columnMetaDataPrivilege =
  HiveAuthzPrivilegesMap.getHiveAuthzPrivileges(HiveOperation.SHOWCOLUMNS);
origin: apache/incubator-sentry

   throws SemanticException {
List<String> filteredResult = new ArrayList<String>();
Subject subject = new Subject(userName);
HiveAuthzPrivileges tableMetaDataPrivilege = new HiveAuthzPrivileges.AuthzPrivilegeBuilder().
  addInputObjectPriviledge(AuthorizableType.Column, EnumSet.of(DBModelAction.SELECT, DBModelAction.INSERT)).
origin: apache/incubator-sentry

 HiveOperation operation, String userName) throws SemanticException {
List<String> filteredResult = new ArrayList<String>();
Subject subject = new Subject(userName);
HiveAuthzBinding hiveBindingWithPrivilegeCache = getHiveBindingWithPrivilegeCache(hiveAuthzBinding, userName);
origin: apache/incubator-sentry

 @Override
 public void checkPrivileges(MPrincipal principal, List<MPrivilege> privileges) throws SqoopException {
  if (privileges == null || privileges.isEmpty()) {
   return;
  }
  PrincipalDesc principalDesc = new PrincipalDesc(principal.getName(), principal.getType());
  if (principalDesc.getType() != PrincipalType.USER) {
   throw new SqoopException(SecurityError.AUTH_0014,SentrySqoopError.AUTHORIZE_CHECK_NOT_SUPPORT_FOR_PRINCIPAL);
  }
  for (MPrivilege privilege : privileges) {
   if (LOG.isDebugEnabled()) {
    LOG.debug("Going to authorize check on privilege : " + privilege +
      " for principal: " + principal);
   }
   if (!binding.authorize(new Subject(principalDesc.getName()), privilege)) {
    throw new SqoopException(SecurityError.AUTH_0014, "User " + principalDesc.getName() +
      " does not have privileges for : " + privilege.toString());
   }
  }
 }
}
origin: apache/incubator-sentry

 throws SolrException {
Subject superUser = new Subject(System.getProperty("solr.authorization.superuser", "solr"));
Subject userName = new Subject(getUserName(req));
long eventTime = req.getStartTime();
String paramString = req.getParamString();
origin: apache/incubator-sentry

/**
 * Test that a user that doesn't exist throws an exception
 * when trying to authorize
 */
@Test
public void testNoUser() throws Exception {
  SolrAuthzConf solrAuthzConf =
   new SolrAuthzConf(Resources.getResource("sentry-site.xml"));
  setUsableAuthzConf(solrAuthzConf);
  SolrAuthzBinding binding = new SolrAuthzBinding(solrAuthzConf);
 try {
  binding.authorizeCollection(new Subject("bogus"), infoCollection, querySet);
  Assert.fail("Expected SentryGroupNotFoundException");
 } catch (SentryGroupNotFoundException e) {
 }
}
origin: apache/incubator-sentry

 HiveAuthzBinding hiveAuthzBinding = getHiveAuthzBinding();
 hiveAuthzBinding.authorize(hiveOp, HiveAuthzPrivilegesMap
   .getHiveAuthzPrivileges(hiveOp), new Subject(getUserName()),
   inputHierarchy, outputHierarchy);
} catch (AuthorizationException e1) {
org.apache.sentry.core.commonSubject<init>

Popular methods of Subject

  • getName

Popular in Java

  • Finding current android device location
  • putExtra (Intent)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Top Vim 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