本文整理了Java中org.apache.accumulo.core.security.Authorizations.getAuthorizations()
方法的一些代码示例,展示了Authorizations.getAuthorizations()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Authorizations.getAuthorizations()
方法的具体详情如下:
包路径:org.apache.accumulo.core.security.Authorizations
类名称:Authorizations
方法名:getAuthorizations
[英]Gets the authorizations in sorted order. The returned list is not modifiable.
[中]按排序顺序获取授权。返回的列表不可修改。
代码示例来源:origin: apache/accumulo
@Override
public Iterator
return getAuthorizations().iterator();
}
代码示例来源:origin: apache/accumulo
/**
* Creates a new {@link Authorizations} object with escaped forms of the authorizations in the
* given object.
*
* @param auths
* original authorizations
* @return authorizations object with escaped authorization strings
* @see #escape(byte[], boolean)
*/
static Authorizations escape(Authorizations auths) {
ArrayList
for (byte[] auth : auths.getAuthorizations())
retAuths.add(escape(auth, false));
return new Authorizations(retAuths);
}
代码示例来源:origin: apache/accumulo
@Override
public void changeUserAuthorizations(final String principal, final Authorizations authorizations)
throws AccumuloException, AccumuloSecurityException {
checkArgument(principal != null, "principal is null");
checkArgument(authorizations != null, "authorizations is null");
executeVoid(client -> client.changeAuthorizations(Tracer.traceInfo(), context.rpcCreds(),
principal, ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations())));
}
代码示例来源:origin: apache/accumulo
ByteBufferUtil.toByteBuffers(auths.getAuthorizations()), tableId.canonicalID(),
DurabilityImpl.toThrift(durability), this.classLoaderContext);
代码示例来源:origin: apache/accumulo
thriftTabletRanges, Translator.translate(columns, Translators.CT),
options.serverSideIteratorList, options.serverSideIteratorOptions,
ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()), waitForWrites,
SamplerConfigurationImpl.toThrift(options.getSamplerConfiguration()),
options.batchTimeOut, options.classLoaderContext, execHints);
代码示例来源:origin: org.apache.accumulo/accumulo-core
@Override
public Iterator
return getAuthorizations().iterator();
}
代码示例来源:origin: apache/incubator-rya
/**
* Gets the authorizations in sorted order. The returned list is not modifiable.
* @param authorizations the {@link Authorizations}
* @return authorizations, each as a string encoded in UTF-8
*/
public static List
final List
for (final byte[] auth : authorizations.getAuthorizations()) {
copy.add(new String(auth, Charsets.UTF_8));
}
return Collections.unmodifiableList(copy);
}
}
代码示例来源:origin: org.apache.rya/mongodb.rya
/**
* Gets the authorizations in sorted order. The returned list is not modifiable.
* @param authorizations the {@link Authorizations}
* @return authorizations, each as a string encoded in UTF-8
*/
public static List
final List
for (final byte[] auth : authorizations.getAuthorizations()) {
copy.add(new String(auth, Charsets.UTF_8));
}
return Collections.unmodifiableList(copy);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
/**
* Creates a new {@link Authorizations} object with escaped forms of the authorizations in the
* given object.
*
* @param auths
* original authorizations
* @return authorizations object with escaped authorization strings
* @see #escape(byte[], boolean)
*/
static Authorizations escape(Authorizations auths) {
ArrayList
for (byte[] auth : auths.getAuthorizations())
retAuths.add(escape(auth, false));
return new Authorizations(retAuths);
}
代码示例来源:origin: apache/incubator-rya
/**
* Adds authorizations to a user's authorizations list.
* @param user the name of the user to add authorizations for.
* @param secOps the {@link SecurityOperations}.
* @param auths the {@link Authorizations} to add
* @return the {@link Authorizations}.
* @throws AccumuloException
* @throws AccumuloSecurityException
*/
public static Authorizations addUserAuths(final String user, final SecurityOperations secOps, final Authorizations auths) throws AccumuloException, AccumuloSecurityException {
final List
for (final byte[] authBytes : auths.getAuthorizations()) {
final String auth = new String(authBytes, StandardCharsets.UTF_8);
authList.add(auth);
}
return addUserAuths(user, secOps, authList.toArray(new String[0]));
}
代码示例来源:origin: org.apache.rya/rya.export.accumulo
/**
* Adds authorizations to a user's authorizations list.
* @param user the name of the user to add authorizations for.
* @param secOps the {@link SecurityOperations}.
* @param auths the {@link Authorizations} to add
* @return the {@link Authorizations}.
* @throws AccumuloException
* @throws AccumuloSecurityException
*/
public static Authorizations addUserAuths(final String user, final SecurityOperations secOps, final Authorizations auths) throws AccumuloException, AccumuloSecurityException {
final List
for (final byte[] authBytes : auths.getAuthorizations()) {
final String auth = new String(authBytes, StandardCharsets.UTF_8);
authList.add(auth);
}
return addUserAuths(user, secOps, authList.toArray(new String[0]));
}
代码示例来源:origin: apache/incubator-rya
/**
* Adds authorizations to a user's authorizations list.
* @param user the name of the user to add authorizations for.
* @param secOps the {@link SecurityOperations}.
* @param auths the {@link Authorizations} to add
* @return the {@link Authorizations}.
* @throws AccumuloException
* @throws AccumuloSecurityException
*/
public static Authorizations addUserAuths(final String user, final SecurityOperations secOps, final Authorizations auths) throws AccumuloException, AccumuloSecurityException {
final List
for (final byte[] authBytes : auths.getAuthorizations()) {
final String auth = new String(authBytes, StandardCharsets.UTF_8);
authList.add(auth);
}
return addUserAuths(user, secOps, authList.toArray(new String[0]));
}
代码示例来源:origin: org.apache.rya/rya.export.accumulo
/**
* Adds authorizations to a user's authorizations list.
* @param user the name of the user to add authorizations for.
* @param secOps the {@link SecurityOperations}.
* @param auths the list of authorizations to add
* @return the {@link Authorizations}.
* @throws AccumuloException
* @throws AccumuloSecurityException
*/
public static Authorizations addUserAuths(final String user, final SecurityOperations secOps, final String... auths) throws AccumuloException, AccumuloSecurityException {
final Authorizations currentUserAuths = secOps.getUserAuthorizations(user);
final List
for (final byte[] currentAuth : currentUserAuths.getAuthorizations()) {
authList.add(currentAuth);
}
for (final String newAuth : auths) {
authList.add(newAuth.getBytes(StandardCharsets.UTF_8));
}
final Authorizations result = new Authorizations(authList);
return result;
}
代码示例来源:origin: apache/incubator-rya
/**
* Adds authorizations to a user's authorizations list.
* @param user the name of the user to add authorizations for.
* @param secOps the {@link SecurityOperations}.
* @param auths the list of authorizations to add
* @return the {@link Authorizations}.
* @throws AccumuloException
* @throws AccumuloSecurityException
*/
public static Authorizations addUserAuths(final String user, final SecurityOperations secOps, final String... auths) throws AccumuloException, AccumuloSecurityException {
final Authorizations currentUserAuths = secOps.getUserAuthorizations(user);
final List
for (final byte[] currentAuth : currentUserAuths.getAuthorizations()) {
authList.add(currentAuth);
}
for (final String newAuth : auths) {
authList.add(newAuth.getBytes(StandardCharsets.UTF_8));
}
final Authorizations result = new Authorizations(authList);
return result;
}
代码示例来源:origin: apache/incubator-rya
/**
* Adds authorizations to a user's authorizations list.
* @param user the name of the user to add authorizations for.
* @param secOps the {@link SecurityOperations}.
* @param auths the list of authorizations to add
* @return the {@link Authorizations}.
* @throws AccumuloException
* @throws AccumuloSecurityException
*/
public static Authorizations addUserAuths(final String user, final SecurityOperations secOps, final String... auths) throws AccumuloException, AccumuloSecurityException {
final Authorizations currentUserAuths = secOps.getUserAuthorizations(user);
final List
for (final byte[] currentAuth : currentUserAuths.getAuthorizations()) {
authList.add(currentAuth);
}
for (final String newAuth : auths) {
authList.add(newAuth.getBytes(StandardCharsets.UTF_8));
}
final Authorizations result = new Authorizations(authList);
return result;
}
代码示例来源:origin: org.apache.rya/rya.pcj.fluo.api
private String[] getAuths(final Connector accumulo) {
Authorizations auths;
try {
auths = accumulo.securityOperations().getUserAuthorizations(accumulo.whoami());
final List
final String[] authArray = new String[authList.size()];
for(int i = 0; i
}
return authArray;
} catch (AccumuloException | AccumuloSecurityException | UnsupportedEncodingException e) {
throw new RuntimeException("Cannot read authorizations for user: " + accumulo.whoami());
}
}
}
代码示例来源:origin: apache/incubator-rya
private String[] getAuths(final Connector accumulo) {
Authorizations auths;
try {
auths = accumulo.securityOperations().getUserAuthorizations(accumulo.whoami());
final List
final String[] authArray = new String[authList.size()];
for(int i = 0; i
}
return authArray;
} catch (AccumuloException | AccumuloSecurityException | UnsupportedEncodingException e) {
throw new RuntimeException("Cannot read authorizations for user: " + accumulo.whoami());
}
}
}
代码示例来源:origin: NationalSecurityAgency/datawave
private void retrieveAccumuloAuthorizations() throws Exception {
Map
Connector c = accumuloConnectionFactory.getConnection(AccumuloConnectionFactory.Priority.ADMIN, trackingMap);
try {
Authorizations auths = c.securityOperations().getUserAuthorizations(c.whoami());
HashSet
for (byte[] auth : auths.getAuthorizations()) {
authSet.add(new String(auth).intern());
}
accumuloUserAuths = Collections.unmodifiableSet(authSet);
log.debug("Accumulo User Authorizations: {}", accumuloUserAuths);
} finally {
accumuloConnectionFactory.returnConnection(c);
}
}
}
代码示例来源:origin: org.securegraph.examples/examples-base
protected void addAuthorizationToUser(String visibilityString) {
LOGGER.debug("adding auth " + visibilityString);
if (getGraph() instanceof AccumuloGraph) {
try {
org.apache.accumulo.core.client.Connector cOnnector= ((AccumuloGraph) getGraph()).getConnector();
String principal = ((AccumuloGraph) getGraph()).getConnector().whoami();
org.apache.accumulo.core.security.Authorizations authorizatiOns= connector.securityOperations().getUserAuthorizations(principal);
if (authorizations.contains(visibilityString)) {
return;
}
String[] newAuthorizatiOns= new String[authorizations.getAuthorizations().size() + 1];
int i;
for (i = 0; i
}
newAuthorizations[i] = visibilityString;
connector.securityOperations().changeUserAuthorizations(principal, new org.apache.accumulo.core.security.Authorizations(newAuthorizations));
} catch (Exception ex) {
throw new RuntimeException("Could not add auths", ex);
}
} else {
throw new RuntimeException("Unhandled graph type to add authorizations: " + getGraph().getClass().getName());
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
@Override
public void execute(ClientService.Client client) throws Exception {
client.changeAuthorizations(Tracer.traceInfo(), context.rpcCreds(), principal,
ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()));
}
});