Create new User
The Create new User
operation creates a new user in Keycloak. The data is defined in the input XML expected by the adapter.
Input
<?xml version="1.0" encoding="UTF-8"?>
<User>
<Username></Username>
<FirstName></FirstName>
<LastName></LastName>
<Email></Email>
<EmailVerified></EmailVerified>
<Enabled></Enabled>
<Attributes>
<Attribute>
<Name></Name>
<Values>
<Value></Value>
</Values>
</Attribute>
</Attributes>
<Credentials>
<Credential>
<Type></Type>
<Value></Value>
<Temporary></Temporary>
</Credential>
</Credentials>
</User>
User
Element | Description | Possible values |
---|---|---|
User | The element contains the following elements:
| |
Username | The user name desired by the user | Any string |
FirstName | The first name of the user | Any string |
LastName | The last name of the user | Any string |
Email | The e-mail address of the user | E-mail address |
EmailVerified | Specifies whether the specified e-mail address is verified. |
|
Enabled | Specifies whether the user is enabled or disabled |
|
Attributes | Personalized, configurable attributes | The element contains the following elements:
|
Credentials | User credentials | The element contains the following element:
|
Attributes
Element | Description | |
---|---|---|
Attributes | Personalized, configurable attributes | The element contains the following elements:
|
Attribute | Personalized, configurable attribute | The element contains the following elements:
|
Name | Attribute name | Any string |
Values | Attribute values | The element contains the following elements:
|
Value | Attribute value | Any string |
Credentials
The Credentials
element defines the type of credential and the associated value. This can be a password, for example.
Element | Description | Possible values |
---|---|---|
Credentials | User credentials | The element contains the following elements:
|
Credential | Login data set | The element contains the following elements:
|
Type | Type of login data set, e.g. password |
|
Value | Attribute value | Any string |
Temporary | Specifies whether the password is temporary |
|
XSD
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="User">
<xs:complexType>
<xs:sequence>
<xs:element ref="Username"/>
<xs:element ref="FirstName"/>
<xs:element ref="LastName"/>
<xs:element ref="Email"/>
<xs:element ref="EmailVerified"/>
<xs:element ref="Enabled"/>
<xs:element ref="Attributes"/>
<xs:element ref="Credentials"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Username" type="xs:NCName"/>
<xs:element name="FirstName" type="xs:NCName"/>
<xs:element name="LastName" type="xs:NCName"/>
<xs:element name="Email" type="xs:string"/>
<xs:element name="EmailVerified" type="xs:boolean"/>
<xs:element name="Enabled" type="xs:boolean"/>
<xs:element name="Attributes">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="Attribute"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Attribute">
<xs:complexType>
<xs:sequence>
<xs:element ref="Name"/>
<xs:element ref="Values"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Values">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="Value"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Credentials">
<xs:complexType>
<xs:sequence>
<xs:element ref="Credential"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Credential">
<xs:complexType>
<xs:sequence>
<xs:element ref="Type"/>
<xs:element ref="Value"/>
<xs:element ref="Temporary"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Type" type="xs:NCName"/>
<xs:element name="Temporary" type="xs:boolean"/>
<xs:element name="Value" type="xs:string"/>
</xs:schema>
Example
Input
<?xml version="1.0" encoding="UTF-8"?>
<User>
<Username>JohnDoe</Username>
<FirstName>John</FirstName>
<LastName>Doe</LastName>
<Email>John.Doe@example.com</Email>
<EmailVerified>true</EmailVerified>
<Enabled>true</Enabled>
<Attributes>
<Attribute>
<Name>Employment Relationship</Name>
<Values>
<Value>Software Developer</Value>
<Value>Sub-Team Lead</Value>
</Values>
</Attribute>
</Attributes>
<Credentials>
<Credential>
<Type>password</Type>
<Value>password123</Value>
<Temporary>false</Temporary>
</Credential>
</Credentials>
</User>