DirContext identityContext = identity != null ? identity.getDirContext() : null; MapAttributes attributes = new MapAttributes(); attributes.addAll(extractSimpleAttributes(entry)); attributes.addAll(extractFilteredAttributes(entry, context, identityContext)); if (attributes.isEmpty()) { log.debugf("Identity [%s] does not have any attributes.", name); } else { log.debugf("Identity [%s] attributes are:", name); attributes.keySet().forEach(key -> { org.wildfly.security.authz.Attributes.Entry values = attributes.get(key); values.forEach(value -> log.debugf(" Attribute [%s] value [%s].", key, value)); }); return attributes.asReadOnly(); } finally { closeContext(context);
private JdbcIdentity getIdentity() { if (!loaded && this.identity == null) { MapAttributes attributes = new MapAttributes(); IdentityCredentials credentials = IdentityCredentials.NONE; boolean found = false; Object value = attributeMapper.map(resultSet, providers); if (value != null) { if (attributes.containsKey(attributeMapper.getName())) { attributes.get(attributeMapper.getName()).add(value.toString()); } else { attributes.addFirst(attributeMapper.getName(), value.toString());
/** * Returns a {@link Attributes} instance based on the given {@link JsonObject}. * * @param claims a json object with the claims to extract * @return an {@link Attributes} instance with attributes from the given json object */ public static Attributes toAttributes(JsonObject claims) { return claims.entrySet().stream().reduce(new MapAttributes(), (mapAttributes, entry) -> { String claimName = entry.getKey(); JsonValue claimValue = entry.getValue(); if (JsonValue.ValueType.ARRAY.equals(claimValue.getValueType())) { JsonArray jsonArray = claims.getJsonArray(claimName); jsonArray.forEach(arrayValue -> mapAttributes.addLast(claimName, asString(arrayValue))); } else { mapAttributes.addLast(claimName, asString(claimValue)); } return mapAttributes; }, (mapAttributes, mapAttributes2) -> mapAttributes); }
@Override public AuthorizationIdentity getAuthorizationIdentity() throws RealmUnavailableException { return AuthorizationIdentity.basicIdentity(new MapAttributes(Collections.singletonMap(groupsAttribute, accountEntry.getGroups()))); } };
public int size() { return MapAttributes.this.size(); } };
private Attributes parseAttributes(final XMLStreamReader streamReader) throws RealmUnavailableException, XMLStreamException { final int attributeCount = streamReader.getAttributeCount(); if (attributeCount > 0) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } int tag = streamReader.nextTag(); if (tag == END_ELEMENT) { return Attributes.EMPTY; } Attributes attributes = new MapAttributes(); do { if (! validNamespace(streamReader.getNamespaceURI())) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } if ("attribute".equals(streamReader.getLocalName())) { parseAttribute(streamReader, attributes); } else { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } } while (streamReader.nextTag() == START_ELEMENT); return attributes; }
public int size() { return MapAttributes.this.size(); } };
DirContext identityContext = identity != null ? identity.getDirContext() : null; MapAttributes attributes = new MapAttributes(); attributes.addAll(extractSimpleAttributes(entry)); attributes.addAll(extractFilteredAttributes(entry, context, identityContext)); if (attributes.isEmpty()) { log.debugf("Identity [%s] does not have any attributes.", name); } else { log.debugf("Identity [%s] attributes are:", name); attributes.keySet().forEach(key -> { org.wildfly.security.authz.Attributes.Entry values = attributes.get(key); values.forEach(value -> log.debugf(" Attribute [%s] value [%s].", key, value)); }); return attributes.asReadOnly(); } finally { closeContext(context);
attributes = new MapAttributes();
private JdbcIdentity getIdentity() { if (!loaded && this.identity == null) { MapAttributes attributes = new MapAttributes(); IdentityCredentials credentials = IdentityCredentials.NONE; boolean found = false; Object value = attributeMapper.map(resultSet, providers); if (value != null) { if (attributes.containsKey(attributeMapper.getName())) { attributes.get(attributeMapper.getName()).add(value.toString()); } else { attributes.addFirst(attributeMapper.getName(), value.toString());
/** * Returns a {@link Attributes} instance based on the given {@link JsonObject}. * * @param claims a json object with the claims to extract * @return an {@link Attributes} instance with attributes from the given json object */ public static Attributes toAttributes(JsonObject claims) { return claims.entrySet().stream().reduce(new MapAttributes(), (mapAttributes, entry) -> { String claimName = entry.getKey(); JsonValue claimValue = entry.getValue(); if (JsonValue.ValueType.ARRAY.equals(claimValue.getValueType())) { JsonArray jsonArray = claims.getJsonArray(claimName); jsonArray.forEach(arrayValue -> mapAttributes.addLast(claimName, asString(arrayValue))); } else { mapAttributes.addLast(claimName, asString(claimValue)); } return mapAttributes; }, (mapAttributes, mapAttributes2) -> mapAttributes); }
public int size() { return MapAttributes.this.size(); } };
DirContext identityContext = identity != null ? identity.getDirContext() : null; MapAttributes attributes = new MapAttributes(); attributes.addAll(extractSimpleAttributes(entry)); attributes.addAll(extractFilteredAttributes(entry, context, identityContext)); if (attributes.isEmpty()) { log.debugf("Identity [%s] does not have any attributes.", name); } else { log.debugf("Identity [%s] attributes are:", name); attributes.keySet().forEach(key -> { org.wildfly.security.authz.Attributes.Entry values = attributes.get(key); values.forEach(value -> log.debugf(" Attribute [%s] value [%s].", key, value)); }); return attributes.asReadOnly(); } finally { closeContext(context);
@Override public AuthorizationIdentity getAuthorizationIdentity() throws RealmUnavailableException { if (this.authenticatedSubject == null){ throw SecurityLogger.ROOT_LOGGER.unableToCreateAuthorizationIdentity(); } Attributes attributes = null; /* process the JAAS subject, extracting attributes from groups that might have been set in the subject by the JAAS login modules (e.g. caller principal, roles) */ final Set<Principal> principals = authenticatedSubject.getPrincipals(); if (principals != null) { for (Principal principal : principals) { if (principal instanceof Group) { final Set<String> values = this.processGroup((Group) principal); if (attributes == null) { attributes = new MapAttributes(); } attributes.addAll(principal.getName(), values); } } } if (attributes == null) attributes = Attributes.EMPTY; return AuthorizationIdentity.basicIdentity(attributes); }
private JdbcIdentity getIdentity() { if (!loaded && this.identity == null) { MapAttributes attributes = new MapAttributes(); IdentityCredentials credentials = IdentityCredentials.NONE; boolean found = false; Object value = attributeMapper.map(resultSet, providers); if (value != null) { if (attributes.containsKey(attributeMapper.getName())) { attributes.get(attributeMapper.getName()).add(value.toString()); } else { attributes.addFirst(attributeMapper.getName(), value.toString());
/** * Returns a {@link Attributes} instance based on the given {@link JsonObject}. * * @param claims a json object with the claims to extract * @return an {@link Attributes} instance with attributes from the given json object */ public static Attributes toAttributes(JsonObject claims) { return claims.entrySet().stream().reduce(new MapAttributes(), (mapAttributes, entry) -> { String claimName = entry.getKey(); JsonValue claimValue = entry.getValue(); if (JsonValue.ValueType.ARRAY.equals(claimValue.getValueType())) { JsonArray jsonArray = claims.getJsonArray(claimName); jsonArray.forEach(arrayValue -> mapAttributes.addLast(claimName, asString(arrayValue))); } else { mapAttributes.addLast(claimName, asString(claimValue)); } return mapAttributes; }, (mapAttributes, mapAttributes2) -> mapAttributes); }
public int size() { return MapAttributes.this.size(); } };
DirContext identityContext = identity != null ? identity.getDirContext() : null; MapAttributes attributes = new MapAttributes(); attributes.addAll(extractSimpleAttributes(entry)); attributes.addAll(extractFilteredAttributes(entry, context, identityContext)); if (attributes.isEmpty()) { log.debugf("Identity [%s] does not have any attributes.", name); } else { log.debugf("Identity [%s] attributes are:", name); attributes.keySet().forEach(key -> { org.wildfly.security.authz.Attributes.Entry values = attributes.get(key); values.forEach(value -> log.debugf(" Attribute [%s] value [%s].", key, value)); }); return attributes.asReadOnly(); } finally { closeContext(context);
@Override public AuthorizationIdentity getAuthorizationIdentity() throws RealmUnavailableException { Map<String, List<String>> groupsAttributeMap = new HashMap<String, List<String>>(); groupsAttributeMap.put("GROUPS", Arrays.asList(groups)); return AuthorizationIdentity.basicIdentity(new MapAttributes(Collections.unmodifiableMap(groupsAttributeMap))); }
private JdbcIdentity getIdentity() { if (!loaded && this.identity == null) { MapAttributes attributes = new MapAttributes(); IdentityCredentials credentials = IdentityCredentials.NONE; boolean found = false; Object value = attributeMapper.map(resultSet, providers); if (value != null) { if (attributes.containsKey(attributeMapper.getName())) { attributes.get(attributeMapper.getName()).add(value.toString()); } else { attributes.addFirst(attributeMapper.getName(), value.toString());