apereo/cas · warning

Client name for [ ] is set to a generated value of [ ]…

Error message

Client name for [{}] is set to a generated value of [{}]. Consider defining an explicit name for the delegated provider

What it means

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.

Solutions

  1. Set an explicit client name, e.g. cas.authn.pac4j.oidc[0].client-name=MyOidcProvider, in the provider configuration.
  2. If constructing clients programmatically, call client.setName(...) or provide the name via the client configuration object before registration.
  3. Update any registered-service delegatedAuthenticationPolicy allowed-providers lists to match the now-stable explicit name.

Example fix

// before
cas.authn.pac4j.oidc[0].client-id=abc
cas.authn.pac4j.oidc[0].client-secret=xyz
// after
cas.authn.pac4j.oidc[0].client-name=my-oidc
cas.authn.pac4j.oidc[0].client-id=abc
cas.authn.pac4j.oidc[0].client-secret=xyz
Defensive patterns

Strategy: validation

Validate before calling

// at config load time
if (StringUtils.isBlank(pac4jProperties.getClientName())) { throw new IllegalStateException("client-name must be set for delegated provider"); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of apereo/cas@e7288fc434 (2026-09-08). Data as JSON: /api/errors/f1007e8045dc0845. Report an issue: GitHub.

Appendix: source

Thrown at support/cas-server-support-pac4j-api/src/main/java/org/apereo/cas/pac4j/client/DelegatedIdentityProviderFactory.java:89

     * @return the list
     * @throws Exception the exception
     */
    List<BaseClient> buildFrom(CasConfigurationProperties properties) throws Exception;

    /**
     * Configure client name.
     *
     * @param client     the client
     * @param clientName the client name
     */
    static void configureClientName(final BaseClient client, final String clientName) {
        if (StringUtils.isNotBlank(clientName)) {
            client.setName(clientName);
        } else {
            val className = client.getClass().getSimpleName();
            val genName = className.concat(RandomUtils.randomNumeric(4));
            client.setName(genName);
            LOGGER.warn("Client name for [{}] is set to a generated value of [{}]. "
                + "Consider defining an explicit name for the delegated provider", className, genName);
        }
    }

    /**
     * Configure client custom properties.
     *
     * @param client           the client
     * @param clientProperties the client properties
     */
    static void configureClientCustomProperties(final BaseClient client, final Pac4jBaseClientProperties clientProperties) {
        val customProperties = client.getCustomProperties();
        customProperties.put(ClientCustomPropertyConstants.CLIENT_CUSTOM_PROPERTY_AUTO_REDIRECT_TYPE, clientProperties.getAutoRedirectType());

        FunctionUtils.doIfNotBlank(clientProperties.getPrincipalIdAttribute(),
            _ -> customProperties.put(ClientCustomPropertyConstants.CLIENT_CUSTOM_PROPERTY_PRINCIPAL_ATTRIBUTE_ID, clientProperties.getPrincipalIdAttribute()));
        FunctionUtils.doIfNotBlank(clientProperties.getCssClass(),
            _ -> customProperties.put(ClientCustomPropertyConstants.CLIENT_CUSTOM_PROPERTY_CSS_CLASS, clientProperties.getCssClass()));

View on GitHub (pinned to e7288fc434)