本文整理了Java中org.wildfly.security.authz.Attributes.addLast()
方法的一些代码示例,展示了Attributes.addLast()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attributes.addLast()
方法的具体详情如下:
包路径:org.wildfly.security.authz.Attributes
类名称:Attributes
方法名:addLast
[英]Add a value after the last mapping for the given key.
[中]在给定键的最后一次映射后添加一个值。
代码示例来源:origin: wildfly/wildfly
public boolean add(final String s) {
attributes.addLast(key, s);
return true;
}
代码示例来源:origin: wildfly/wildfly
private void parseAttribute(final XMLStreamReader streamReader, final Attributes attributes) throws XMLStreamException, RealmUnavailableException {
String name = null;
String value = null;
final int attributeCount = streamReader.getAttributeCount();
for (int i = 0; i < attributeCount; i++) {
String namespace = streamReader.getAttributeNamespace(i);
if (namespace != null && !namespace.equals("")) {
throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name);
}
if ("name".equals(streamReader.getAttributeLocalName(i))) {
name = streamReader.getAttributeValue(i);
} else if ("value".equals(streamReader.getAttributeLocalName(i))) {
value = streamReader.getAttributeValue(i);
} else {
throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name);
}
}
if (name == null) {
throw ElytronMessages.log.fileSystemRealmMissingAttribute("name", path, streamReader.getLocation().getLineNumber(), this.name);
}
if (value == null) {
throw ElytronMessages.log.fileSystemRealmMissingAttribute("value", path, streamReader.getLocation().getLineNumber(), this.name);
}
attributes.addLast(name, value);
if (streamReader.nextTag() != END_ELEMENT) {
throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name);
}
}
代码示例来源:origin: wildfly/wildfly
/**
* Add all the values from the given collection to the value collection for the given key.
*
* @param key the key
* @param values the values to add
* @return {@code true} if elements were added, {@code false} otherwise
*/
default boolean addAll(String key, Collection<String> values) {
Assert.checkNotNullParam("key", key);
Assert.checkNotNullParam("values", values);
boolean changed = false;
for (String s : values) {
if (s != null) {
addLast(key, s);
changed = true;
}
}
return changed;
}
代码示例来源:origin: org.wildfly.security/wildfly-elytron
public boolean add(final String s) {
attributes.addLast(key, s);
return true;
}
代码示例来源:origin: org.wildfly.security/wildfly-elytron-auth-server
public boolean add(final String s) {
attributes.addLast(key, s);
return true;
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
public boolean add(final String s) {
attributes.addLast(key, s);
return true;
}
代码示例来源:origin: org.wildfly.security/wildfly-elytron
private void parseAttribute(final XMLStreamReader streamReader, final Attributes attributes) throws XMLStreamException, RealmUnavailableException {
String name = null;
String value = null;
final int attributeCount = streamReader.getAttributeCount();
for (int i = 0; i < attributeCount; i++) {
String namespace = streamReader.getAttributeNamespace(i);
if (namespace != null && !namespace.equals("")) {
throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name);
}
if ("name".equals(streamReader.getAttributeLocalName(i))) {
name = streamReader.getAttributeValue(i);
} else if ("value".equals(streamReader.getAttributeLocalName(i))) {
value = streamReader.getAttributeValue(i);
} else {
throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name);
}
}
if (name == null) {
throw ElytronMessages.log.fileSystemRealmMissingAttribute("name", path, streamReader.getLocation().getLineNumber(), this.name);
}
if (value == null) {
throw ElytronMessages.log.fileSystemRealmMissingAttribute("value", path, streamReader.getLocation().getLineNumber(), this.name);
}
attributes.addLast(name, value);
if (streamReader.nextTag() != END_ELEMENT) {
throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name);
}
}
代码示例来源:origin: org.wildfly.security/wildfly-elytron-realm
private void parseAttribute(final XMLStreamReader streamReader, final Attributes attributes) throws XMLStreamException, RealmUnavailableException {
String name = null;
String value = null;
final int attributeCount = streamReader.getAttributeCount();
for (int i = 0; i < attributeCount; i++) {
String namespace = streamReader.getAttributeNamespace(i);
if (namespace != null && !namespace.equals("")) {
throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name);
}
if ("name".equals(streamReader.getAttributeLocalName(i))) {
name = streamReader.getAttributeValue(i);
} else if ("value".equals(streamReader.getAttributeLocalName(i))) {
value = streamReader.getAttributeValue(i);
} else {
throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name);
}
}
if (name == null) {
throw ElytronMessages.log.fileSystemRealmMissingAttribute("name", path, streamReader.getLocation().getLineNumber(), this.name);
}
if (value == null) {
throw ElytronMessages.log.fileSystemRealmMissingAttribute("value", path, streamReader.getLocation().getLineNumber(), this.name);
}
attributes.addLast(name, value);
if (streamReader.nextTag() != END_ELEMENT) {
throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name);
}
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
private void parseAttribute(final XMLStreamReader streamReader, final Attributes attributes) throws XMLStreamException, RealmUnavailableException {
String name = null;
String value = null;
final int attributeCount = streamReader.getAttributeCount();
for (int i = 0; i < attributeCount; i++) {
String namespace = streamReader.getAttributeNamespace(i);
if (namespace != null && !namespace.equals("")) {
throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name);
}
if ("name".equals(streamReader.getAttributeLocalName(i))) {
name = streamReader.getAttributeValue(i);
} else if ("value".equals(streamReader.getAttributeLocalName(i))) {
value = streamReader.getAttributeValue(i);
} else {
throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name);
}
}
if (name == null) {
throw ElytronMessages.log.fileSystemRealmMissingAttribute("name", path, streamReader.getLocation().getLineNumber(), this.name);
}
if (value == null) {
throw ElytronMessages.log.fileSystemRealmMissingAttribute("value", path, streamReader.getLocation().getLineNumber(), this.name);
}
attributes.addLast(name, value);
if (streamReader.nextTag() != END_ELEMENT) {
throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), this.name);
}
}
代码示例来源:origin: org.wildfly.security/wildfly-elytron-auth-server
/**
* Add all the values from the given collection to the value collection for the given key.
*
* @param key the key
* @param values the values to add
* @return {@code true} if elements were added, {@code false} otherwise
*/
default boolean addAll(String key, Collection<String> values) {
Assert.checkNotNullParam("key", key);
Assert.checkNotNullParam("values", values);
boolean changed = false;
for (String s : values) {
if (s != null) {
addLast(key, s);
changed = true;
}
}
return changed;
}
代码示例来源:origin: org.wildfly.security/wildfly-elytron
/**
* Add all the values from the given collection to the value collection for the given key.
*
* @param key the key
* @param values the values to add
* @return {@code true} if elements were added, {@code false} otherwise
*/
default boolean addAll(String key, Collection<String> values) {
Assert.checkNotNullParam("key", key);
Assert.checkNotNullParam("values", values);
boolean changed = false;
for (String s : values) {
if (s != null) {
addLast(key, s);
changed = true;
}
}
return changed;
}
代码示例来源:origin: org.jboss.eap/wildfly-client-all
/**
* Add all the values from the given collection to the value collection for the given key.
*
* @param key the key
* @param values the values to add
* @return {@code true} if elements were added, {@code false} otherwise
*/
default boolean addAll(String key, Collection<String> values) {
Assert.checkNotNullParam("key", key);
Assert.checkNotNullParam("values", values);
boolean changed = false;
for (String s : values) {
if (s != null) {
addLast(key, s);
changed = true;
}
}
return changed;
}
代码示例来源:origin: wildfly/wildfly-core
@Override
protected void executeRuntimeStep(final OperationContext context, final ModelNode operation) throws OperationFailedException {
String principalName = IDENTITY.resolveModelAttribute(context, operation).asString();
ModifiableRealmIdentity realmIdentity = getRealmIdentity(context, principalName);
AuthorizationIdentity authorizationIdentity;
try {
authorizationIdentity = realmIdentity.getAuthorizationIdentity();
} catch (RealmUnavailableException e) {
throw ROOT_LOGGER.couldNotObtainAuthorizationIdentity(e);
}
try {
Attributes attributes = new MapAttributes(authorizationIdentity.getAttributes());
String name = NAME.resolveModelAttribute(context, operation).asString();
for (ModelNode modelNode : VALUES.resolveModelAttribute(context, operation).asList()) {
attributes.addLast(name, modelNode.asString());
}
realmIdentity.setAttributes(attributes);
} catch (RealmUnavailableException e) {
throw ROOT_LOGGER.couldNotAddAttribute(e);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!