Providers Management
As an on-premise customer you have the ability to configure and use an authentication provider that differs from the git provider (i.e. Okta as authentication provider and GitLab as git provider). In order to do it, you must configure a service account.
In the following sections, you will see how to use the relative APIs to create a new provider and associate the respective token, which will be appropriately encrypted to ensure a high standard of security.
Providers APIs
In order to create a new provider you must call the respective API using the console's API Portal, under the "Providers" tag.
Two main APIs are exposed:
- POST -
/api/backend/providers
: used to create a new provider; - PATCH -
/api/backend/providers/{providerId}
: used to edit an existing provider.
These APIs are protected and can be used only if you belong to the group access_token_manager
.
Provider creation
To create a new provider, you must invoke the API /api/backend/providers
.
Here is the request body:
We can divide it in two categories: provider data and credentials data.
The provider data fields are:
- id (string): it will be used to identify the provider;
- label (string): an human-readable name for the provider;
- type (string): the type of provider you are going to insert;
- urls (object): an object that contains:
- apiBase (string): the API base url of the provider;
- base (string): the base url of the provider.
The credentials data fields are:
- type (string): the type of credentials that you are going to insert;info
Currently
token
anduserPass
are the only supported values - content (object): a dynamic object that contains the credentials of the service account.
- For type
userPass
, content must includeuserName
andpassword
fields; - For type
token
, content must include onlyaccessToken
field.
- For type
Below you can find a complete example of the request:
{
"id": "my-github-provider",
"label": "Mia-Platform GitHub",
"type": "github",
"urls": {
"apiBase": "https://api.github.com",
"baseUrl": "https://github.com"
},
"credentials": {
"type": "token",
"content": {
"accessToken": "my-super-super-super-secret-token"
}
}
}
The credentials are stored encrypted in MongoDB.
For more information, take a look at the dedicated documentation section.
Associate provider
To associate the created provider to your project, you can use the CMS.
Navigate through the Projects
section, select the desired project and change the providerId
in the Repository
section.
Provider editing
To edit an existing provider, you must invoke the API /api/backend/providers/{providerId}
.
The request of this endpoint is identical to the previous one, except that here you have to insert the providerId
in the endpoint instead of the request body.