{"record":{"id":"f1007e8045dc0845","repo":"apereo/cas","slug":"client-name-for-is-set-to-a-generated-value-o","errorCode":null,"errorMessage":"Client name for [{}] is set to a generated value of [{}]. Consider defining an explicit name for the delegated provider","messagePattern":"Client name for \\[(.+?)\\] is set to a generated value of \\[(.+?)\\]\\. Consider defining an explicit name for the delegated provider","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"support/cas-server-support-pac4j-api/src/main/java/org/apereo/cas/pac4j/client/DelegatedIdentityProviderFactory.java","lineNumber":89,"sourceCode":"     * @return the list\n     * @throws Exception the exception\n     */\n    List<BaseClient> buildFrom(CasConfigurationProperties properties) throws Exception;\n\n    /**\n     * Configure client name.\n     *\n     * @param client     the client\n     * @param clientName the client name\n     */\n    static void configureClientName(final BaseClient client, final String clientName) {\n        if (StringUtils.isNotBlank(clientName)) {\n            client.setName(clientName);\n        } else {\n            val className = client.getClass().getSimpleName();\n            val genName = className.concat(RandomUtils.randomNumeric(4));\n            client.setName(genName);\n            LOGGER.warn(\"Client name for [{}] is set to a generated value of [{}]. \"\n                + \"Consider defining an explicit name for the delegated provider\", className, genName);\n        }\n    }\n\n    /**\n     * Configure client custom properties.\n     *\n     * @param client           the client\n     * @param clientProperties the client properties\n     */\n    static void configureClientCustomProperties(final BaseClient client, final Pac4jBaseClientProperties clientProperties) {\n        val customProperties = client.getCustomProperties();\n        customProperties.put(ClientCustomPropertyConstants.CLIENT_CUSTOM_PROPERTY_AUTO_REDIRECT_TYPE, clientProperties.getAutoRedirectType());\n\n        FunctionUtils.doIfNotBlank(clientProperties.getPrincipalIdAttribute(),\n            _ -> customProperties.put(ClientCustomPropertyConstants.CLIENT_CUSTOM_PROPERTY_PRINCIPAL_ATTRIBUTE_ID, clientProperties.getPrincipalIdAttribute()));\n        FunctionUtils.doIfNotBlank(clientProperties.getCssClass(),\n            _ -> customProperties.put(ClientCustomPropertyConstants.CLIENT_CUSTOM_PROPERTY_CSS_CLASS, clientProperties.getCssClass()));","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/support/cas-server-support-pac4j-api/src/main/java/org/apereo/cas/pac4j/client/DelegatedIdentityProviderFactory.java#L71-L107","documentation":"DelegatedIdentityProviderFactory.configureClientName warns when a delegated identity provider client has no explicit client name configured. CAS generates a random name (simple class name + 4 random digits), which is unstable across restarts and can break stored references, so the developer is advised to name the client explicitly.","triggerScenarios":"A pac4j client (e.g. OAuth/OIDC/SAML client in cas.authn.pac4j.* config) is registered without cas.authn.pac4j.<client>.client-name or an explicit name in the client definition, so the blank clientName branch runs at identity-provider factory build time.","commonSituations":"Minimal delegated auth configurations omitting the client-name property; auto-configuration creating clients where only the main settings (clientId/secret) were supplied; downstream service delegatedAuthn provider allowlists referencing names that then change per restart.","solutions":["Set an explicit client name, e.g. cas.authn.pac4j.oidc[0].client-name=MyOidcProvider, in the provider configuration.","If constructing clients programmatically, call client.setName(...) or provide the name via the client configuration object before registration.","Update any registered-service delegatedAuthenticationPolicy allowed-providers lists to match the now-stable explicit name."],"exampleFix":"// before\ncas.authn.pac4j.oidc[0].client-id=abc\ncas.authn.pac4j.oidc[0].client-secret=xyz\n// after\ncas.authn.pac4j.oidc[0].client-name=my-oidc\ncas.authn.pac4j.oidc[0].client-id=abc\ncas.authn.pac4j.oidc[0].client-secret=xyz","handlingStrategy":"validation","validationCode":"// at config load time\nif (StringUtils.isBlank(pac4jProperties.getClientName())) { throw new IllegalStateException(\"client-name must be set for delegated provider\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set an explicit client-name for every delegated provider.","Keep registered-service allowed-providers lists in sync with explicit client names."],"tags":["pac4j","delegated-authentication","configuration","naming"],"backgroundTag":"missing-required-config-field","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"}