-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#171549246] Add function to create a new user #30
Conversation
CreateUser/handler.ts
Outdated
toError | ||
).map( | ||
credentials => | ||
// the below cast to `any` is needed to prevent build errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be solved using 4.x version of azure graph package:
https://github.com/gunzip/adb2c-apim-migrate/blob/master/package.json#L8
openapi/index.yaml
Outdated
@@ -280,6 +280,26 @@ paths: | |||
description: List of users | |||
schema: | |||
$ref: "#/definitions/UserCollection" | |||
post: | |||
summary: Create user | |||
description: Create a new User with a random password on the Active Directory Azure B2C and create the corresponding User on the APIM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description: Create a new User with a random password on the Active Directory Azure B2C and create the corresponding User on the APIM. | |
description: Create a new user with a random password in the Active Directory Azure B2C, then create a corresponding user on the API management resource. |
README.md
Outdated
@@ -19,6 +19,9 @@ they may be customized as needed. | |||
| SERVICE_PRINCIPAL_CLIENT_ID | The service principal name used to get the token credentials to connect to the APIM | string | | |||
| SERVICE_PRINCIPAL_SECRET | The service principal secret used to get the token credentials to connect to the APIM | string | | |||
| SERVICE_PRINCIPAL_TENANT_ID | The service principal tenant id used to get the token credentials to connect to the APIM | string | | |||
| ADB2C_CLIENT_ID | The service principal name used to get the token credentials to connect to the ADB2C | string | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these are parameters relative to an application registered into the ADB2C tenant
README.md
Outdated
@@ -19,6 +19,9 @@ they may be customized as needed. | |||
| SERVICE_PRINCIPAL_CLIENT_ID | The service principal name used to get the token credentials to connect to the APIM | string | | |||
| SERVICE_PRINCIPAL_SECRET | The service principal secret used to get the token credentials to connect to the APIM | string | | |||
| SERVICE_PRINCIPAL_TENANT_ID | The service principal tenant id used to get the token credentials to connect to the APIM | string | | |||
| ADB2C_CLIENT_ID | The service principal name used to get the token credentials to connect to the ADB2C | string | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ADB2C_CLIENT_ID | The service principal name used to get the token credentials to connect to the ADB2C | string | | |
| ADB2C_CLIENT_ID | The application client id used to get the token credentials to connect to the ADB2C | string | |
README.md
Outdated
@@ -19,6 +19,9 @@ they may be customized as needed. | |||
| SERVICE_PRINCIPAL_CLIENT_ID | The service principal name used to get the token credentials to connect to the APIM | string | | |||
| SERVICE_PRINCIPAL_SECRET | The service principal secret used to get the token credentials to connect to the APIM | string | | |||
| SERVICE_PRINCIPAL_TENANT_ID | The service principal tenant id used to get the token credentials to connect to the APIM | string | | |||
| ADB2C_CLIENT_ID | The service principal name used to get the token credentials to connect to the ADB2C | string | | |||
| ADB2C_CLIENT_KEY | The service principal secret used to get the token credentials to connect to the ADB2C | string | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ADB2C_CLIENT_KEY | The service principal secret used to get the token credentials to connect to the ADB2C | string | | |
| ADB2C_CLIENT_KEY | The application secret used to get the token credentials to connect to the ADB2C | string | |
README.md
Outdated
@@ -19,6 +19,9 @@ they may be customized as needed. | |||
| SERVICE_PRINCIPAL_CLIENT_ID | The service principal name used to get the token credentials to connect to the APIM | string | | |||
| SERVICE_PRINCIPAL_SECRET | The service principal secret used to get the token credentials to connect to the APIM | string | | |||
| SERVICE_PRINCIPAL_TENANT_ID | The service principal tenant id used to get the token credentials to connect to the APIM | string | | |||
| ADB2C_CLIENT_ID | The service principal name used to get the token credentials to connect to the ADB2C | string | | |||
| ADB2C_CLIENT_KEY | The service principal secret used to get the token credentials to connect to the ADB2C | string | | |||
| ADB2C_TENANT_ID | The service principal tenant id used to get the token credentials to connect to the ADB2C | string | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ADB2C_TENANT_ID | The service principal tenant id used to get the token credentials to connect to the ADB2C | string | | |
| ADB2C_TENANT_ID | The ADB2C tenant id | string | |
CreateUser/handler.ts
Outdated
.chain(userCreateResponse => | ||
getApiClient(apimCredentials, azureApimConfig.subscriptionId) | ||
.mapLeft(error => | ||
internalErrorHandler("Could not get the APIM client", error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
internalErrorHandler("Could not get the APIM client", error) | |
internalErrorHandler("Could not get the API management client", error) |
CreateUser/handler.ts
Outdated
taskResults.apimClient.user.createOrUpdate( | ||
azureApimConfig.apimResourceGroup, | ||
azureApimConfig.apim, | ||
taskResults.userId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``
taskResults.userId, | |
taskResults.objectId, |
azureApimConfig.apimResourceGroup, | ||
azureApimConfig.apim, | ||
taskResults.userId, | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you must link the adb2c identity to the one generated into the adb2c, see this code:
https://github.com/gunzip/adb2c-apim-migrate/blob/master/migrate.ts#L280
This PR aims to create a User on the Active Directory Azure B2C and on the API Management.