TeamCity REST API Reference 2024.07 Help

Manage Server Authentication Settings

TeamCity allows users to log in via default username/password credentials and using external authentication sources such as Windows Domain, LDAP, or Git hosting providers. See this documentation article to learn more: Configuring Authentication Settings.

In REST API, send GET and PUT requests to the <TeamCity_server_URL>/app/rest/server/authSettings endpoint to obtain and modify these authentication settings. These requests accept and return ServerAuthSettings payloads.

Example 1: Enable Guest User Access

This request allows unregistered users to access the TeamCity UI. To specify guest users' permissions, utilize the /app/rest/users and /app/rest/roles endpoints.

Request:

http://localhost:8111/app/rest/server/authSettings

Body (XML):

<serverAuthSettings allowGuest="true" collapseLoginForm="false" emailVerification="false" guestUsername="TC_Guest" perProjectPermissions="true" welcomeText=""> <modules> <module name="Default"> <properties count="3"> <property name="usersCanResetOwnPasswords" value="true"/> <property name="usersCanChangeOwnPasswords" value="true"/> <property name="freeRegistrationAllowed" value="false"/> </properties> </module> <module name="Token-Auth"> <properties count="0"/> </module> <module name="LDAP"> <properties count="1"> <property name="allowCreatingNewUsersByLogin" value="true"/> </properties> </module> <module name="HTTP-Basic"> <properties count="0"/> </module> </modules> </serverAuthSettings>

Example 2: Add an Authentication Module

This request allows users to sign in using their Bitbucket Cloud accounts.

Request:

https://mycompany.com:80/app/rest/server/authSettings

Body (JSON):

{ "allowGuest": false, "collapseLoginForm": false, "emailVerification": false, "guestUsername": "guest", "perProjectPermissions": true, "welcomeText": "", "modules": { "module": [ { "name": "Default", "properties": { "property": [ { "name": "usersCanResetOwnPasswords", "value": true }, { "name": "usersCanChangeOwnPasswords", "value": true }, { "name": "usersCanChangeOwnPasswords", "value": false } ] } }, { "name": "Token-Auth" }, { "name": "LDAP", "properties": { "property": [ { "name": "allowCreatingNewUsersByLogin", "value": true } ] } }, { "name":"BitBucketCloud-oauth", "properties": { "property": [ { "name": "allowCreatingNewUsersByLogin", "value": true }, { "name": "workspace", "value": "" } ] } } ] } }
Last modified: 24 May 2023