user

package
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package user synchronises email addresses from an Azure Active Directory tenancy. It is a read-only adapter, so it does not provide any functionality to create or delete entries in AD.

Requirements

In order to synchronise with Azure AD, you'll need to ensure you have an App Registration with the following API Permissions:

  • User.Read.All

You will also need credentials for the App Registration to be configured appropriately in the environment using one of the default authentication mechanisms.

Index

Examples

Constants

View Source
const Filter gosync.ConfigKey = "filter"

Filter is an optional filter for filtering down the users to return See the reference for more information on filter queries.

Variables

This section is empty.

Functions

func WithClient added in v0.14.1

func WithClient(client iClient) func(u *User)

WithClient provides a mechanism to pass a custom client to the adapter.

func WithFilter

func WithFilter(f string) func(u *User)

WithFilter provides a mechanism to set the Microsoft Graph query filter when instantiating a new User adapter with the user.New method.

Types

type User

type User struct {
	Logger *log.Logger
	// contains filtered or unexported fields
}

func Init

func Init(
	_ context.Context,
	config map[gosync.ConfigKey]string,
	configFns ...gosync.ConfigFn[*User],
) (*User, error)

Init creates a new Adapter. By default, an Azure Graph Service Client will be created using the default credentials in the environment.

Example
package main

import (
	"context"
	"log"

	gosync "github.com/ovotech/go-sync"
	"github.com/ovotech/go-sync/adapters/azuread/user"
)

func main() {
	adapter, err := user.Init(context.TODO(), map[gosync.ConfigKey]string{
		user.Filter: "endsWith(mail, '@example.com')",
	})
	if err != nil {
		log.Fatal(err)
	}

	gosync.New(adapter)
}
Output:

func (*User) Add

func (u *User) Add(_ context.Context, _ []string) error

func (*User) Get

func (u *User) Get(ctx context.Context) ([]string, error)

func (*User) Remove

func (u *User) Remove(_ context.Context, _ []string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL