apolloconfig/apollo · error · UnsupportedOperationException
change user enabled is unsupported
Error message
change user enabled is unsupported
What it means
Thrown by UserInfoController.changeUserEnabled (PUT /users/enabled) when userService is NOT a SpringSecurityUserService. The endpoint (super-admin only via @PreAuthorize) has no implementation to toggle the enabled flag for other UserService impls. UnsupportedOperationException → typically HTTP 500.
Source
Thrown at apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/UserInfoController.java:103
if (userService instanceof SpringSecurityUserService) {
if (isCreate) {
((SpringSecurityUserService) userService).create(user);
} else {
((SpringSecurityUserService) userService).update(user);
}
} else {
throw new UnsupportedOperationException("Create or update user operation is unsupported");
}
}
@PreAuthorize(value = "@unifiedPermissionValidator.isSuperAdmin()")
@PutMapping("/users/enabled")
public void changeUserEnabled(@RequestBody UserPO user) {
if (userService instanceof SpringSecurityUserService) {
((SpringSecurityUserService) userService).changeEnabled(user);
} else {
throw new UnsupportedOperationException("change user enabled is unsupported");
}
}
@GetMapping("/user")
public UserInfo getCurrentUserName() {
return userInfoHolder.getUser();
}
@GetMapping("/user/logout")
public void logout(HttpServletRequest request, HttpServletResponse response) {
logoutHandler.logout(request, response);
}
@GetMapping("/users")
public List<UserInfo> searchUsersByKeyword(@RequestParam(value = "keyword") String keyword,
@RequestParam(value = "includeInactiveUsers",
defaultValue = "false") boolean includeInactiveUsers,
@RequestParam(value = "offset", defaultValue = "0") int offset,View on GitHub (pinned to d95fc18d11)
Solutions
- Enable/disable users in the upstream identity provider (LDAP/SSO) when not using the DB user store.
- If portal-local enable/disable is required, configure SpringSecurityUserService via the appropriate auth profile.
- Confirm the active UserService bean class before invoking the endpoint.
Example fix
// before
putUsersEnabled(user); // UnsupportedOperationException
// after
if (!(userService instanceof SpringSecurityUserService)) {
throw new IllegalStateException("enable/disable requires the DB user store; manage the account in your IdP");
}
putUsersEnabled(user); Defensive patterns
Strategy: type-guard
Validate before calling
if (!(userService instanceof SpringSecurityUserService)) {
return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body("enable/disable requires the DB-backed user store");
} Type guard
boolean supportsEnableDisable(UserService svc) { return svc instanceof SpringSecurityUserService; } Prevention
- Use PUT /users/enabled only with the DB user store.
- Manage enable/disable in the upstream IdP for LDAP/SSO setups.
- Verify the UserService impl before invoking.
When it happens
Trigger: PUT /users/enabled on a portal using a non-DB UserService (LDAP/SSO/custom), where the bean is not SpringSecurityUserService.
Common situations: LDAP-backed deployment where an admin tries to enable/disable a portal user through this endpoint; custom UserService SPI that does not implement changeEnabled.
Related errors
- Unsupported auth type: %s
- Username and password can not be empty.
- Create or update user operation is unsupported
- Password needs a number and letter and between 8~20 characte
- User is disabled
AI-assisted analysis of apolloconfig/apollo@d95fc18d11 (2026-08-14).
Data as JSON: /api/errors/6664318d90206fe6.
Report an issue: GitHub.