{"record":{"id":"fa64d18a3a04f7f3","repo":"apereo/cas","slug":"unable-to-accept-username","errorCode":null,"errorMessage":"Unable to accept username ","messagePattern":"Unable to accept username ","errorType":"exception","errorClass":"PreventedException","httpStatus":null,"severity":"error","filePath":"core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/transforms/BlockingPrincipalNameTransformer.java","lineNumber":30,"sourceCode":" * and throws back an error if a match is found.\n *\n * @author Misagh Moayyed\n * @since 6.4.0\n */\n@Setter\npublic class BlockingPrincipalNameTransformer implements PrincipalNameTransformer {\n\n    private Pattern pattern;\n\n    public BlockingPrincipalNameTransformer(final String pattern) {\n        setPattern(RegexUtils.createPattern(pattern));\n    }\n\n    @Override\n    public String transform(final String username) {\n        val matcher = this.pattern.matcher(username);\n        if (matcher.find()) {\n            throw new PreventedException(\"Unable to accept username \" + username);\n        }\n        return username.trim();\n    }\n}\n","sourceCodeStart":12,"sourceCodeEnd":35,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/transforms/BlockingPrincipalNameTransformer.java#L12-L35","documentation":"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.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e7288fc434b4f4505b8452e1a57e8fb3111bb863","analyzedAt":"2026-09-08T15:39:16.015Z","contentChangedAt":"2026-09-08T15:39:16.015Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}