This is a port of the nodejs version https://github.com/judedaryl/ieftool which removes any dependency on nodejs and external libraries and reduces the file size to 9mb.
This tool enhances the development experience with B2C policies, policies can now be multi-environment
by introducing different variable values depending on the environment and helps you upload your policies to Azure B2C seamlessly.
B2C policies are built on xml and has no support for variables, ieftool introduces a build command that lets you inject variables to your policies either through a configuration file or environment variables. See the build command below for more information.
Policies are uploaded in-order based on the inheritance of a policy. Uploads are also faster because policies are uploaded by batch depending on its position on the inheritance tree.
src/
├─ social/
│ ├─ base.xml (1A_SBASE)
│ ├─ signupsignin.xml (1A_SSS)
├─ local/
│ ├─ base.xml (1A_LBASE)
│ ├─ signupsignin.xml (1A_LSS)
│ ├─ passwordreset.xml (1A_LPR)
├─ base.xml (1A_BASE)
├─ extension.xml (1A_EXT)
The example folder structure above has the following inheritance tree.
1A_BASE
|
1A_EXT
/ \
1A_LBASE 1A_SBASE
/ \ \
1A_LSS 1A_LPR 1A_SSS
These policies are then batched by their hierarchy in the tree, as well as their parent policy. The order of upload would then be.
- 1A_Base
- 1A_EXT
- 1A_LBASE, 1A_SBASE
- 1A_LSS, 1A_LPR
- 1A_LSSS
Install via curl
curl https://raw.githubusercontent.com/judedaryl/go-ieftool/main/install.sh | bash
Compiles and injects variable values into source IEF policies (.xml). The variables are extracted from a configuration file that you can provide using --config
or -c
(defaults to ieftool.config
). The build command can also pickup environment variables that start with IEF_*
ieftool build [path to source code] [path to target directory] [flags]
flag | alias | type | description |
---|---|---|---|
--config | -c | string | Path to the ieftool configuration file (yaml) (default "ieftool.config") |
--help | -h | - | help for build |
ieftool.config
tenantId: mytenant.onmicrosoft.com
deploymentMode: Development
src/BasePolicy.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TrustFrameworkPolicy
...
TenantId="{{ tenantId }}"
DeploymentMode="{{ deploymentMode }}"
SomeData="{{ fromEnv }}">
...
</xml>
Run the build command
export IEF_fromEnv=FromEnvironment
# ieftool build [source dir] [target dir] -c [config path]
ieftool build src output -c ieftool.config
The policies are then compiled into
output/BasePolicy.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TrustFrameworkPolicy
...
TenantId="mytenant.onmicrosoft.com"
DeploymentMode="Development"
SomeData="FromEnvironment">
...
</xml>
Deploys your policies into Identity Experience Framework.
ieftool deploy [path to policies] [flags]
flag | alias | type | description |
---|---|---|---|
--help | -h | - | help for build |
Credentials are set using environment variables
export B2C_TENANT_ID=mytenant.onmicrosoft.com
export B2C_CLIENT_ID=00000000-0000-0000-0000-000000000000
export B2C_CLIENT_SECRET=some_secret
# ieftool deploy [path to policies]
ieftool deploy {POLICY_PATH}