Can't create user and assign role on RH-SSO 7.x REST API

Solution Verified - Updated -

Issue

Need to create a user and assign a specific role to this user using the RH-SSO 7.x REST API with the following JSON, however, the role is not applied to this user.

  • Request: http://{{host}}:{{port}}/auth/admin/realms/{{realm_name}}/users
  • Body
{
        "username": "Strange",
        "enabled": true,
        "totp": false,
        "emailVerified": true,
        "firstName": "Stephen",
        "lastName": "Strange",
        "email": "drstranger@marvel.com",
        "disableableCredentialTypes": [],
        "requiredActions": [],
        "notBefore": 0,
        "access": {
            "manageGroupMembership": true,
            "view": true,
            "mapRoles": true,
            "impersonate": true,
            "manage": true
        },
        "realmRoles": ["admin"]
    }

Environment

Red Hat Single Sign-On (RH-SSO) 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content