Is it possible to create a SAML external role using the REST API?

Is it possible to create a SAML external role mapping using the REST API? We are using Nexus Repository Manager PRO 3.41.0-01.

In the web interface it is possible to specify external role mapping and SAML

I don’t remember exactly how it works off the top of my head, but you can fetch the role configuration via the API to see how to map external roles. The REST API will work just fine for creating external roles, it’s just not obvious how and I don’t think we’ve documented anywhere how it works.

Just did a quick test and it looks like you can do a normal POST to the roles rest api with something like this to create a new externally-mapped role. The id is the name of the role from SAML and the name is just the name to use in nxrm.

{
  "id": "saml-mapped-role",
  "source": "default",
  "name": "saml-mapped-role-name",
  "description": "saml-mapped-role-description",
  "readOnly": false,
  "privileges": [
    "nx-all"
  ],
  "roles": [
    "nx-admin"
  ]
}

Great!

I will test tomorrow. Thank you!