{"record":{"id":"3e20daab5404f561","repo":"apereo/cas","slug":"authentication-request-does-contain-a-client-id","errorCode":null,"errorMessage":"Authentication request does contain a client id","messagePattern":"Authentication request does contain a client id","errorType":"validation","errorClass":"InvalidResourceSetException","httpStatus":400,"severity":"error","filePath":"support/cas-server-support-oauth-uma-core/src/main/java/org/apereo/cas/uma/ticket/resource/ResourceSet.java","lineNumber":72,"sourceCode":"    @Column\n    private String owner;\n\n    @Column\n    private String clientId;\n    \n    @Column(columnDefinition = \"json\")\n    @Type(JsonType.class)\n    private Set<ResourceSetPolicy> policies = new HashSet<>();\n\n    /**\n     * Validate.\n     *\n     * @param profile the profile\n     */\n    @JsonIgnore\n    public void validate(final UserProfile profile) {\n        if (StringUtils.isBlank(getClientId())) {\n            throw new InvalidResourceSetException(HttpStatus.BAD_REQUEST.value(), \"Authentication request does contain a client id\");\n        }\n\n        if (getScopes().isEmpty()) {\n            throw new InvalidResourceSetException(HttpStatus.BAD_REQUEST.value(), \"Resource set registration is missing scopes\");\n        }\n\n        if (!getOwner().equals(profile.getId())) {\n            throw new InvalidResourceSetException(HttpStatus.FORBIDDEN.value(), \"Resource-set owner does not match the authenticated profile\");\n        }\n    }\n}\n","sourceCodeStart":54,"sourceCodeEnd":84,"githubUrl":"https://github.com/apereo/cas/blob/e7288fc434b4f4505b8452e1a57e8fb3111bb863/support/cas-server-support-oauth-uma-core/src/main/java/org/apereo/cas/uma/ticket/resource/ResourceSet.java#L54-L84","documentation":"A UMA resource set must carry the client id of the registering OAuth service. When ResourceSet.validate(profile) finds a blank clientId it throws InvalidResourceSetException with HTTP 400, rejecting the resource-set registration request.","triggerScenarios":"Registering a UMA resource set (POST to the resource_set registration endpoint) with a JSON body lacking the clientId field, or with clientId empty/whitespace, calling ResourceSet.validate.","commonSituations":"Client forgot to include clientId in the resource-set registration payload; JSON field name mismatch (client_id vs clientId) so it deserializes to null; registering via a tool that builds the body from an incomplete template.","solutions":["Include the registered service's clientId in the resource-set registration JSON body","Check the JSON property name is exactly 'clientId' as bound by the ResourceSet model","Confirm the OAuth service itself is registered in CAS and its id/clientId is used verbatim","Validate the payload client-side before POSTing"],"exampleFix":"// before\n{\"name\":\"photos\",\"scopes\":[\"read\"]}\n// after\n{\"name\":\"photos\",\"clientId\":\"myClient\",\"scopes\":[\"read\"]}","handlingStrategy":"validation","validationCode":"if (resourceSet.getClientId() == null || resourceSet.getClientId().isBlank()) {\n  throw new IllegalArgumentException(\"clientId is required for UMA resource set registration\");\n}","typeGuard":"boolean hasClientId(ResourceSet rs) { return rs.getClientId() != null && !rs.getClientId().isBlank(); }","tryCatchPattern":"try { registerResourceSet(rs); } catch (InvalidResourceSetException e) { return ResponseEntity.badRequest().body(e.getMessage()); }","preventionTips":["Always include clientId in the registration JSON","Double-check JSON field naming (clientId, not client_id)","Build payloads from a schema/template that includes required fields"],"tags":["uma","resource-set","validation","http-400"],"backgroundTag":"missing-required-argument","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"}