apereo/cas · warning
Attribute definition contains a key property
Error message
Attribute definition contains a key property [{}] that differs from its registering key [{}]. This is likely due to misconfiguration of the attribute definition, and CAS will use the key property [{}] to register the attribute definition in the attribute store What it means
AbstractAttributeDefinitionStore.registerAttributeDefinition detected that an AttributeDefinition's 'key' property differs from the map key under which it was registered. CAS warns that this is likely misconfiguration and resolves the conflict by preferring the definition's key property when storing the attribute.
Solutions
- Align the definition's key property with the registering map key so the warning disappears
- If the inner key is intentional, accept the warning — CAS will use the inner key in the attribute store
- Review generated/default definition files after upgrades for key/entry mismatches
Example fix
// before (JSON attribute definitions)
"email": { "key": "mail" }
// after
"email": { "key": "email" } Defensive patterns
Strategy: validation
Validate before calling
entries.forEach((k, def) -> { if (def.getKey() != null && !def.getKey().equalsIgnoreCase(k)) throw new IllegalStateException("key mismatch for " + k); }); Type guard
boolean keysMatch(String registeringKey, AttributeDefinition def) { return def.getKey() == null || def.getKey().isBlank() || def.getKey().equalsIgnoreCase(registeringKey); } Prevention
- Validate attribute definition files at build time
- Keep entry name and key property identical by convention
- Run schema/lint checks on definition JSON after edits
When it happens
Trigger: Calling registerAttributeDefinitions with a map where map-key != definition.getKey() (e.g., JSON/Groovy attribute definitions where the 'key' field doesn't match the outer entry name).
Common situations: Hand-edited attribute definition JSON with mismatched entry name and key property; copy-pasted definition renamed only on the outside; programmatic registration using a different map key.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Unable to use 'none' as introspection signing algorithm
- Unable to use 'none' as introspection encryption algorithm
- Unable to use 'none' for the user-info signing algorithm
- Unable to use 'none' as user-info encryption algorithm
- The resulting authentication attempt has not recorded any…
AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08).
Data as JSON: /api/errors/1ce6460f08a8ee4e.
Report an issue: GitHub.
Appendix: source
Thrown at core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/attribute/AbstractAttributeDefinitionStore.java:70
@Getter
private String scope = StringUtils.EMPTY;
protected AbstractAttributeDefinitionStore(final AttributeDefinition... definitions) {
Arrays.stream(definitions).forEach(this::registerAttributeDefinition);
}
/**
* Register attribute definitions.
*
* @param entries the entries
*/
public void registerAttributeDefinitions(final Map<String, AttributeDefinition> entries) {
entries.forEach(this::registerAttributeDefinition);
}
private static String getAttributeDefinitionKey(final String key, final AttributeDefinition definition) {
if (StringUtils.isNotBlank(definition.getKey()) && !Strings.CI.equals(definition.getKey(), key)) {
LOGGER.warn("Attribute definition contains a key property [{}] that differs from its registering key [{}]. "
+ "This is likely due to misconfiguration of the attribute definition, and CAS will use the key property [{}] "
+ "to register the attribute definition in the attribute store", definition.getKey(), key, definition.getKey());
return definition.getKey();
}
return key;
}
@Override
@CanIgnoreReturnValue
public AttributeDefinitionStore registerAttributeDefinition(final AttributeDefinition definition) {
return registerAttributeDefinition(definition.getKey(), definition);
}
@Override
@CanIgnoreReturnValue
public AttributeDefinitionStore registerAttributeDefinition(final String key, final AttributeDefinition definition) {
LOGGER.trace("Registering attribute definition [{}] by key [{}]", definition, key);
val keyToUse = getAttributeDefinitionKey(key, definition);View on GitHub (pinned to e7288fc434)