Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/schumann-it/azure-b2c-sdk-for-go
https://github.com/schumann-it/azure-b2c-sdk-for-go
Last synced: about 2 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 (10 months ago)
- Default Branch: main
- Last Pushed: 2024-06-21T11:48:16.000Z (7 months ago)
- Last Synced: 2024-06-21T14:16:34.381Z (7 months ago)
- Language: Go
- Size: 791 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Azure AD B2C SDK for Go
![Tests](https://github.com/Schumann-IT/azure-b2c-sdk-for-go/actions/workflows/test.yml/badge.svg)
![Coverage](https://img.shields.io/badge/Coverage-53.8%25-yellow)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)
}
}
```