#16687·awx

API: allow creating a local user without a password (token-only accounts)

Author: quanahCreated Sep 29, 2026Updated Sep 29, 2026
Labelstype:enhancementneeds_triagecommunity

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that AWX is open source software provided for free and that I might not receive a timely response.

Feature type

Enhancement to Existing Feature

Feature Summary

Assisted-by: Claude Opus 5.5 — drafted with AI assistance; the behavior was hit on a live controller and every line cited was read at devel a5b 2179a3e.

Allow POST /api/v2/users/ to create a local user without a password. Such an account would get an unusable password and authenticate only with OAuth2 tokens, which is what automation service accounts want: a local account is required because a user backed by an external authentication provider can't hold an OAuth2 token, but giving it a password creates a credential nobody should use.

The storage side already supports this. UserSerializer._update_password calls set_unusable_password() when no password is given. Only the creation-time check in validate_password prevents it:

python
if not self.instance and value in (None, ''):
    raise serializers.ValidationError(_('Password required for new User.'))

That check dates from 2015 (ec456c4e8b, "user password required on creation"), before OAuth2 tokens existed in AWX.

Select the relevant components

  • UI
  • API
  • Docs
  • Collection
  • CLI
  • Other

Steps to reproduce

bash
$ curl -s -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
    -d '{"username":"svc-ci","is_superuser":false}' https://<controller>/api/v2/users/
{"password":["Password required for new User."]}

Omitting password and sending "password": "" both fail the same way: the field is required=False, default='', so an omitted password reaches validate_password as ''.

Current results

400 {"password":["Password required for new User."]}. The only way to create a token-only account is to invent a password for it. Automation that manages users declaratively then has to generate, send, and discard a password, and configuration tooling that doesn't sometimes falls back to a shared literal instead (redhat-cop/infra.controller_configuration#1456).

Sugested feature result

201, and the user has no usable password (User.has_usable_password() is False), so password login is impossible and only tokens work. Passwords that are supplied keep every existing check: the maximum length, the LOCAL_PASSWORD_MIN_* settings, and AUTH_PASSWORD_VALIDATORS. Updating an existing user is unchanged.

Additional information

A PR implementing this accompanies the issue: a two-line change to validate_password plus functional tests.

A user with no usable password can't be logged into with a password at all, so this doesn't weaken the local password policy: the policy still governs every password that exists.