Examples of HivePrincipal


Examples of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrincipal

  }

  private int grantOrRevokeRoleV2(GrantRevokeRoleDDL grantOrRevokeRoleDDL) throws HiveException {
    HiveAuthorizer authorizer = SessionState.get().getAuthorizerV2();
    //convert to the types needed for plugin api
    HivePrincipal grantorPrinc = null;
    if(grantOrRevokeRoleDDL.getGrantor() != null){
      grantorPrinc = new HivePrincipal(grantOrRevokeRoleDDL.getGrantor(),
          getHivePrincipalType(grantOrRevokeRoleDDL.getGrantorType()));
    }
    List<HivePrincipal> hivePrincipals = getHivePrincipals(grantOrRevokeRoleDDL.getPrincipalDesc());
    List<String> roles = grantOrRevokeRoleDDL.getRoles();
View Full Code Here

Examples of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrincipal

          getHivePrincipal(showGrantDesc.getPrincipalDesc()),
          getHivePrivilegeObject(showGrantDesc.getHiveObj())
          );
      List<HiveObjectPrivilege> privList = new ArrayList<HiveObjectPrivilege>();
      for(HivePrivilegeInfo privInfo : privInfos){
        HivePrincipal principal = privInfo.getPrincipal();
        HivePrivilegeObject privObj = privInfo.getObject();
        HivePrivilege priv = privInfo.getPrivilege();

        PrivilegeGrantInfo grantInfo =
            AuthorizationUtils.getThriftPrivilegeGrantInfo(priv, privInfo.getGrantorPrincipal(),
                privInfo.isGrantOption(), privInfo.getGrantTime());

        //only grantInfo is used
        HiveObjectPrivilege thriftObjectPriv = new HiveObjectPrivilege(new HiveObjectRef(
            AuthorizationUtils.getThriftHiveObjType(privObj.getType()),privObj.getDbname(),
            privObj.getTableViewURI(),null,null), principal.getName(),
            AuthorizationUtils.getThriftPrincipalType(principal.getType()), grantInfo);
        privList.add(thriftObjectPriv);
      }
      boolean testMode = conf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST);
      writeToFile(writeGrantInfo(privList, testMode), showGrantDesc.getResFile());
    } catch (IOException e) {
View Full Code Here

Examples of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrincipal

    //Convert to object types used by the authorization plugin interface
    List<HivePrincipal> hivePrincipals = getHivePrincipals(principals);
    List<HivePrivilege> hivePrivileges = getHivePrivileges(privileges);
    HivePrivilegeObject hivePrivObject = getHivePrivilegeObject(privSubjectDesc);
    HivePrincipal grantorPrincipal = new HivePrincipal(grantor, getHivePrincipalType(grantorType));

    if(isGrant){
      authorizer.grantPrivileges(hivePrincipals, hivePrivileges, hivePrivObject,
          grantorPrincipal, grantOption);
    }else {
View Full Code Here

Examples of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrincipal

  private HivePrincipal getHivePrincipal(PrincipalDesc principal) throws HiveException {
    if (principal == null) {
      return null;
    }
    return new HivePrincipal(principal.getName(),
        AuthorizationUtils.getHivePrincipalType(principal.getType()));
  }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrincipal

      authorizer.dropRole(roleDDLDesc.getName());
      break;
    case SHOW_ROLE_GRANT:
      boolean testMode = conf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST);
      List<HiveRoleGrant> roles = authorizer.getRoleGrantInfoForPrincipal(
          new HivePrincipal(roleDDLDesc.getName(), getHivePrincipalType(roleDDLDesc.getPrincipalType())));
      writeToFile(writeRolesGrantedInfo(roles, testMode), roleDDLDesc.getResFile());
      break;
    case SHOW_ROLES:
      List<String> allRoles = authorizer.getAllRoles();
      writeListToFileAfterSort(allRoles, roleDDLDesc.getResFile());
View Full Code Here

Examples of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrincipal

    RequiredPrivileges availPrivs = SQLAuthorizationUtils.getPrivilegesFromMetaStore(
        metastoreClient, userName, hivePrivObject, curRoles, isAdmin);

    // check if required privileges is subset of available privileges
    Collection<SQLPrivTypeGrant> missingPrivs = reqPrivileges.findMissingPrivs(availPrivs);
    SQLAuthorizationUtils.assertNoMissingPrivilege(missingPrivs, new HivePrincipal(userName,
        HivePrincipalType.USER), hivePrivObject);
  }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrincipal


      // convert the metastore thrift objects to result objects
      for (HiveObjectPrivilege msObjPriv : msObjPrivs) {
        // result principal
        HivePrincipal resPrincipal = new HivePrincipal(msObjPriv.getPrincipalName(),
            AuthorizationUtils.getHivePrincipalType(msObjPriv.getPrincipalType()));

        // result privilege
        PrivilegeGrantInfo msGrantInfo = msObjPriv.getGrantInfo();
        HivePrivilege resPrivilege = new HivePrivilege(msGrantInfo.getPrivilege(), null);

        // result object
        HiveObjectRef msObjRef = msObjPriv.getHiveObject();
        HivePrivilegeObject resPrivObj = new HivePrivilegeObject(
            getPluginObjType(msObjRef.getObjectType()), msObjRef.getDbName(),
            msObjRef.getObjectName());

        // result grantor principal
        HivePrincipal grantorPrincipal = new HivePrincipal(msGrantInfo.getGrantor(),
            AuthorizationUtils.getHivePrincipalType(msGrantInfo.getGrantorType()));

        HivePrivilegeInfo resPrivInfo = new HivePrivilegeInfo(resPrincipal, resPrivilege,
            resPrivObj, grantorPrincipal, msGrantInfo.isGrantOption(), msGrantInfo.getCreateTime());
        resPrivInfos.add(resPrivInfo);
View Full Code Here

Examples of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrincipal

        // get the privileges that this user has on the object
        availPrivs = SQLAuthorizationUtils.getPrivilegesFromMetaStore(metastoreClient, userName,
            hObj, privController.getCurrentRoleNames(), privController.isUserAdmin());
      }
      Collection<SQLPrivTypeGrant> missingPriv = requiredInpPrivs.findMissingPrivs(availPrivs);
      SQLAuthorizationUtils.assertNoMissingPrivilege(missingPriv, new HivePrincipal(userName,
          HivePrincipalType.USER), hObj);

    }
  }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrincipal

  }

  private int grantOrRevokeRoleV2(GrantRevokeRoleDDL grantOrRevokeRoleDDL) throws HiveException {
    HiveAuthorizer authorizer = SessionState.get().getAuthorizerV2();
    //convert to the types needed for plugin api
    HivePrincipal grantorPrinc = null;
    if(grantOrRevokeRoleDDL.getGrantor() != null){
      grantorPrinc = new HivePrincipal(grantOrRevokeRoleDDL.getGrantor(),
          getHivePrincipalType(grantOrRevokeRoleDDL.getGrantorType()));
    }
    List<HivePrincipal> hivePrincipals = getHivePrincipals(grantOrRevokeRoleDDL.getPrincipalDesc());
    List<String> roles = grantOrRevokeRoleDDL.getRoles();
View Full Code Here

Examples of org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrincipal

          getHivePrincipal(showGrantDesc.getPrincipalDesc()),
          getHivePrivilegeObject(showGrantDesc.getHiveObj())
          );
      List<HiveObjectPrivilege> privList = new ArrayList<HiveObjectPrivilege>();
      for(HivePrivilegeInfo privInfo : privInfos){
        HivePrincipal principal = privInfo.getPrincipal();
        HivePrivilegeObject privObj = privInfo.getObject();
        HivePrivilege priv = privInfo.getPrivilege();

        PrivilegeGrantInfo grantInfo =
            AuthorizationUtils.getThriftPrivilegeGrantInfo(priv, privInfo.getGrantorPrincipal(),
                privInfo.isGrantOption(), privInfo.getGrantTime());

        //only grantInfo is used
        HiveObjectPrivilege thriftObjectPriv = new HiveObjectPrivilege(new HiveObjectRef(
            AuthorizationUtils.getThriftHiveObjType(privObj.getType()),privObj.getDbname(),
            privObj.getTableViewURI(),null,null), principal.getName(),
            AuthorizationUtils.getThriftPrincipalType(principal.getType()), grantInfo);
        privList.add(thriftObjectPriv);
      }
      boolean testMode = conf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST);
      writeToFile(writeGrantInfo(privList, testMode), showGrantDesc.getResFile());
    } catch (IOException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.