W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
當(dāng)您發(fā)出掃描或獲取時(shí),HBase會使用您的一組默認(rèn)授權(quán)來過濾掉您無權(quán)訪問的單元格。超級用戶(superuser)可以通過使用set_auths HBase Shell命令或VisibilityClient.setAuths()方法為給定用戶設(shè)置默認(rèn)授權(quán)集。
如果您使用API??,則可以在掃描或獲取期間通過在HBase Shell中傳遞AUTHORIZATIONS選項(xiàng)或在Scan.setAuthorizations()方法中指定不同的授權(quán)。此授權(quán)將與您的默認(rèn)設(shè)置一起作為附加過濾器。它會進(jìn)一步過濾你的結(jié)果,而不是給你額外的授權(quán)。
HBase Shell
hbase> get_auths 'myUser'
hbase> scan 'table1', AUTHORIZATIONS => ['private']
例子:Java API
...
public Void run() throws Exception {
String[] auths1 = { SECRET, CONFIDENTIAL };
GetAuthsResponse authsResponse = null;
try {
VisibilityClient.setAuths(conf, auths1, user);
try {
authsResponse = VisibilityClient.getAuths(conf, user);
} catch (Throwable e) {
fail("Should not have failed");
}
} catch (Throwable e) {
}
List<String> authsList = new ArrayList<String>();
for (ByteString authBS : authsResponse.getAuthList()) {
authsList.add(Bytes.toString(authBS.toByteArray()));
}
assertEquals(2, authsList.size());
assertTrue(authsList.contains(SECRET));
assertTrue(authsList.contains(CONFIDENTIAL));
return null;
}
...
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: