graph

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package graph implements the Microsoft Graph slice that Azure's account inventory, iam-user, and iam-credential validation flows need.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	ID                  string               `json:"id"`
	DisplayName         string               `json:"displayName"`
	AppID               string               `json:"appId"`
	PasswordCredentials []PasswordCredential `json:"passwordCredentials"`
}

Application is a partial projection of the Graph application resource covering only the fields the iam-credential driver needs.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a thin Microsoft Graph wrapper that signs requests with a Graph-scoped token source.

func NewClient

func NewClient(ts *auth.TokenSource, httpClient *http.Client, baseURL string) *Client

NewClient returns a Graph client. Callers typically build the token source via `auth.NewTokenSourceForScope(cred, httpClient, baseURL+".default")`.

func (*Client) AddPassword

func (c *Client) AddPassword(ctx context.Context, appOrObjectID, displayName string) (PasswordCredential, error)

AddPassword mints a fresh client secret on the named application. displayName is optional metadata stored alongside the credential.

func (*Client) CreateUser

func (c *Client) CreateUser(ctx context.Context, displayName, userPrincipalName, password string) (User, error)

CreateUser provisions a Microsoft Graph user (Azure AD user) with the supplied initial password.

func (*Client) DeleteUser

func (c *Client) DeleteUser(ctx context.Context, idOrUPN string) error

DeleteUser removes a Microsoft Graph user by objectId or userPrincipalName.

func (*Client) ListPasswordCredentials

func (c *Client) ListPasswordCredentials(ctx context.Context, appOrObjectID string) (Application, error)

ListPasswordCredentials returns the password credentials attached to the application identified by appOrObjectID. The argument may be either an objectId (preferred — used directly) or an appId (resolved via /applications filter).

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context) ([]User, error)

ListUsers enumerates Microsoft Graph users for cloudlist account inventory.

func (*Client) RemovePassword

func (c *Client) RemovePassword(ctx context.Context, appOrObjectID, keyID string) error

RemovePassword revokes a password credential by keyId.

type PasswordCredential

type PasswordCredential struct {
	KeyID         string `json:"keyId"`
	DisplayName   string `json:"displayName,omitempty"`
	StartDateTime string `json:"startDateTime,omitempty"`
	EndDateTime   string `json:"endDateTime,omitempty"`
	SecretText    string `json:"secretText,omitempty"`
	Hint          string `json:"hint,omitempty"`
}

PasswordCredential mirrors the Microsoft Graph passwordCredential resource.

type SignInActivity

type SignInActivity struct {
	LastSignInDateTime string `json:"lastSignInDateTime,omitempty"`
}

type User

type User struct {
	ID                string               `json:"id,omitempty"`
	AccountEnabled    bool                 `json:"accountEnabled"`
	DisplayName       string               `json:"displayName"`
	MailNickname      string               `json:"mailNickname"`
	UserPrincipalName string               `json:"userPrincipalName"`
	CreatedDateTime   string               `json:"createdDateTime,omitempty"`
	SignInActivity    *SignInActivity      `json:"signInActivity,omitempty"`
	PasswordProfile   *UserPasswordProfile `json:"passwordProfile,omitempty"`
}

User is a slim projection of the Microsoft Graph user resource for the validation flow's needs.

type UserPasswordProfile

type UserPasswordProfile struct {
	Password                      string `json:"password"`
	ForceChangePasswordNextSignIn bool   `json:"forceChangePasswordNextSignIn"`
}

UserPasswordProfile carries the initial password assigned at user creation.

Jump to

Keyboard shortcuts

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