apereo/cas · error · PreventedException
Unable to accept username
Error message
Unable to accept username
What it means
BlockingPrincipalNameTransformer rejects the username because it matches the configured block/regex pattern; PreventedException is thrown so the username is never accepted downstream. This is a deliberate blocklist guard — the input at fault is the submitted username matching the forbidden pattern.
Solutions
- Use a username that does not match the block pattern
- Review the configured regex pattern; it may be overly broad and blocking legitimate users
- If this is a policy check, handle PreventedException as an authentication rejection rather than a system error
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/transforms/BlockingPrincipalNameTransformer.java:30 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08).
Data as JSON: /api/errors/fa64d18a3a04f7f3.
Report an issue: GitHub.
Appendix: source
Thrown at core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/transforms/BlockingPrincipalNameTransformer.java:30
* and throws back an error if a match is found.
*
* @author Misagh Moayyed
* @since 6.4.0
*/
@Setter
public class BlockingPrincipalNameTransformer implements PrincipalNameTransformer {
private Pattern pattern;
public BlockingPrincipalNameTransformer(final String pattern) {
setPattern(RegexUtils.createPattern(pattern));
}
@Override
public String transform(final String username) {
val matcher = this.pattern.matcher(username);
if (matcher.find()) {
throw new PreventedException("Unable to accept username " + username);
}
return username.trim();
}
}
View on GitHub (pinned to e7288fc434)