Categorygithub.com/schumann-it/azure-b2c-sdk-for-go
repositorypackage
0.10.0
Repository: https://github.com/schumann-it/azure-b2c-sdk-for-go.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

Azure AD B2C SDK for Go

Tests Coverage

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 Certificates

The project has been inspired by

Getting started

This project uses Go modules for versioning and dependency management.

To add the latest version to your go.mod file, execute the following command.

go get github.com/Schumann-IT/azure-b2c-sdk-for-go

For more detailed usage examples, please checkout

Usage

  • create config file
- name: test
  settings:
    SomeVariable: SomeTestContent 
- name: prod
  settings:
    SomeVariable: SomeProdContent 
  • create some policies
src/
├─ local/
│  ├─ base.xml 
│  ├─ signupsignin.xml 
│  ├─ passwordreset.xml
├─ base.xml 
├─ extension.xml 

Build policies

package main

import (
	"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

package main

import (
	"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)
    }
}