https://github.com/schumann-it/azure-b2c-sdk-for-go
https://github.com/schumann-it/azure-b2c-sdk-for-go
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/schumann-it/azure-b2c-sdk-for-go
- Owner: Schumann-IT
- License: mit
- Created: 2024-03-07T11:24:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-09T03:25:09.000Z (9 months ago)
- Last Synced: 2025-01-15T08:10:27.390Z (6 months ago)
- Language: Go
- Size: 781 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Azure AD B2C SDK for Go

This SDK provides a set of functions to automate Azure B2C
* Patch Azure AD Application to meet B2C requirements
* Build and Deploy policies
* Create Policy Keys and CertificatesThe project has been inspired by
* [go-ieftool](https://github.com/judedaryl/go-ieftool)
* [VS Code extension](https://github.com/azure-ad-b2c/vscode-extension)## Getting started
This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management.
To add the latest version to your `go.mod` file, execute the following command.
```bash
go get github.com/Schumann-IT/azure-b2c-sdk-for-go
```For more detailed usage examples, please checkout
- [go-ieftool](https://github.com/Schumann-IT/go-ieftool)
- [Terraform Provider azureadb2c](https://github.com/Schumann-IT/terraform-provider-azureadb2c)## Usage
* create config file
```yaml
- name: test
settings:
SomeVariable: SomeTestContent
- name: prod
settings:
SomeVariable: SomeProdContent
```* create some policies
```pre
src/
├─ local/
│ ├─ base.xml
│ ├─ signupsignin.xml
│ ├─ passwordreset.xml
├─ base.xml
├─ extension.xml```
### Build policies
```go
package mainimport (
"log""github.com/schumann-it/azure-b2c-sdk-for-go"
)func main() {
service, err := b2c.NewServiceFromConfigFile("environments.yaml")
service.MustWithSourceDir("src")
service.MustWithTargetDir("build")
if err != nil {
log.Fatalf("failed to create service: %w", err)
}
env := "environment_name"
err = service.BuildPolicies("environment_name")
if err != nil {
log.Fatalf("failed to build policies for environment %s: %w", env, err)
}
}
```### Deploy policies
```go
package mainimport (
"log"
"github.com/schumann-it/azure-b2c-sdk-for-go"
)func main() {
service, err := b2c.NewServiceFromConfigFile("environments.yaml")
service.MustWithSourceDir("src")
service.MustWithTargetDir("build")
if err != nil {
log.Fatalf("failed to create service: %w", err)
}env := "test"
err = service.DeployPolicies(env)
if err != nil {
log.Fatalf("failed to deploy policies for environment %s: %w", env, err)
}
}
```