Documentation
¶
Index ¶
- Constants
- Variables
- type APIApplication
- type AdministrativeUnit
- type AlternativeSecurityID
- type AppRole
- type AppRoleAssignment
- type Application
- type Backend
- func (b *Backend) ActivateDirectoryRole(body map[string]jsontext.Value) (map[string]any, error)
- func (b *Backend) AddAdministrativeUnitMember(auID, memberID string) error
- func (b *Backend) AddDirectoryRoleMember(ref Ref, memberID string) error
- func (b *Backend) AddKey(id string, in KeyCredential, proof string) (KeyCredential, error)
- func (b *Backend) AddMember(groupID, memberID string) error
- func (b *Backend) AddOwner(id, ownerID string) error
- func (b *Backend) AddPassword(id string, in PasswordCredential) (PasswordCredential, error)
- func (b *Backend) AddScopedRoleMember(auID string, body map[string]jsontext.Value) (ScopedRoleMembership, error)
- func (b *Backend) AdministrativeUnitMembers(auID string) ([]Object, error)
- func (b *Backend) AuthenticateAssertion(clientID, assertion string, audiences []string) (string, bool, error)
- func (b *Backend) AuthenticateClient(clientID, secret string) (string, bool, error)
- func (b *Backend) AuthenticateUser(username, password string) (string, string, error)
- func (b *Backend) ByIDs(ids, types []string) ([]Object, error)
- func (b *Backend) CreateAdministrativeUnit(body map[string]jsontext.Value) (AdministrativeUnit, error)
- func (b *Backend) CreateAppRoleAssignment(ownerID string, asResource bool, body map[string]jsontext.Value) (AppRoleAssignment, error)
- func (b *Backend) CreateApplication(body map[string]jsontext.Value) (Application, error)
- func (b *Backend) CreateDevice(body map[string]jsontext.Value) (Device, error)
- func (b *Backend) CreateFederatedCredential(appID string, body map[string]jsontext.Value) (FederatedCredential, error)
- func (b *Backend) CreateGrant(body map[string]jsontext.Value) (OAuth2PermissionGrant, error)
- func (b *Backend) CreateGroup(body map[string]jsontext.Value) (Group, error)
- func (b *Backend) CreateRoleAssignment(body map[string]jsontext.Value) (RoleAssignment, error)
- func (b *Backend) CreateRoleDefinition(body map[string]jsontext.Value) (RoleDefinition, error)
- func (b *Backend) CreateServicePrincipal(body map[string]jsontext.Value) (ServicePrincipal, error)
- func (b *Backend) CreateUser(body map[string]jsontext.Value) (User, error)
- func (b *Backend) DeleteAdministrativeUnit(r Ref) error
- func (b *Backend) DeleteAppRoleAssignment(id, assignmentID string, asResource bool) error
- func (b *Backend) DeleteApplication(r Ref) error
- func (b *Backend) DeleteDevice(r Ref) error
- func (b *Backend) DeleteFederatedCredential(appID, key string) error
- func (b *Backend) DeleteGrant(id string) error
- func (b *Backend) DeleteGroup(r Ref) error
- func (b *Backend) DeleteRoleAssignment(id string) error
- func (b *Backend) DeleteRoleDefinition(id string) error
- func (b *Backend) DeleteServicePrincipal(r Ref) error
- func (b *Backend) DeleteUser(r Ref) error
- func (b *Backend) Delta(q deltaQuery) (DeltaPage, error)
- func (b *Backend) DirectReports(id string) ([]Object, error)
- func (b *Backend) DirectoryRoleMembers(ref Ref) ([]Object, error)
- func (b *Backend) DirectoryRoles() []map[string]any
- func (b *Backend) GetAdministrativeUnit(r Ref) (AdministrativeUnit, error)
- func (b *Backend) GetApplication(r Ref) (Application, error)
- func (b *Backend) GetDeleted(id string) (DeletedObject, error)
- func (b *Backend) GetDeletedRoleDefinition(id string) (RoleDefinition, error)
- func (b *Backend) GetDevice(r Ref) (Device, error)
- func (b *Backend) GetDirectoryRole(ref Ref) (map[string]any, error)
- func (b *Backend) GetFederatedCredential(appID, key string) (FederatedCredential, error)
- func (b *Backend) GetGroup(r Ref) (Group, error)
- func (b *Backend) GetObject(id string) (Object, error)
- func (b *Backend) GetRoleAssignment(id string) (RoleAssignment, error)
- func (b *Backend) GetRoleDefinition(id string) (RoleDefinition, error)
- func (b *Backend) GetServicePrincipal(r Ref) (ServicePrincipal, error)
- func (b *Backend) GetUser(r Ref) (User, error)
- func (b *Backend) ListAdministrativeUnits() []AdministrativeUnit
- func (b *Backend) ListAppRoleAssignments(id string, asResource bool) ([]AppRoleAssignment, error)
- func (b *Backend) ListApplications() []Application
- func (b *Backend) ListDeleted(kind string) []DeletedObject
- func (b *Backend) ListDevices() []Device
- func (b *Backend) ListFederatedCredentials(appID string) ([]FederatedCredential, error)
- func (b *Backend) ListGrants() []OAuth2PermissionGrant
- func (b *Backend) ListGroups() []Group
- func (b *Backend) ListRoleAssignments() []RoleAssignment
- func (b *Backend) ListRoleDefinitions() []RoleDefinition
- func (b *Backend) ListServicePrincipals() []ServicePrincipal
- func (b *Backend) ListUsers() []User
- func (b *Backend) Manager(id string) (User, error)
- func (b *Backend) MemberOf(id string, transitive bool) ([]Object, error)
- func (b *Backend) Members(id string) ([]Object, error)
- func (b *Backend) ObjectKind(id string) (string, bool)
- func (b *Backend) Owners(id string) ([]Object, error)
- func (b *Backend) PermanentDelete(id string) error
- func (b *Backend) PermanentDeleteRoleDefinition(id string) error
- func (b *Backend) PrincipalType(id string) (string, bool)
- func (b *Backend) RemoveAdministrativeUnitMember(auID, memberID string) error
- func (b *Backend) RemoveDirectoryRoleMember(ref Ref, memberID string) error
- func (b *Backend) RemoveKey(id, keyID string) error
- func (b *Backend) RemoveManager(id string) error
- func (b *Backend) RemoveMember(groupID, memberID string) error
- func (b *Backend) RemoveOwner(id, ownerID string) error
- func (b *Backend) RemovePassword(id, keyID string) error
- func (b *Backend) RemoveScopedRoleMember(auID, id string) error
- func (b *Backend) Reset()
- func (b *Backend) Restore(ctx context.Context, data []byte) error
- func (b *Backend) RestoreDeleted(id string) (Object, error)
- func (b *Backend) RestoreRoleDefinition(id string) (RoleDefinition, error)
- func (b *Backend) ScopedRoleMembers(auID string) ([]ScopedRoleMembership, error)
- func (b *Backend) SetIssuerKeys(r KeyResolver)
- func (b *Backend) SetManager(id, managerID string) error
- func (b *Backend) Snapshot(ctx context.Context) []byte
- func (b *Backend) TenantID() string
- func (b *Backend) TransitiveMembers(id string) ([]Object, error)
- func (b *Backend) UpdateAdministrativeUnit(r Ref, body map[string]jsontext.Value) error
- func (b *Backend) UpdateApplication(r Ref, body map[string]jsontext.Value) error
- func (b *Backend) UpdateDevice(r Ref, body map[string]jsontext.Value) error
- func (b *Backend) UpdateFederatedCredential(appID, key string, body map[string]jsontext.Value) error
- func (b *Backend) UpdateGrant(id string, body map[string]jsontext.Value) error
- func (b *Backend) UpdateGroup(r Ref, body map[string]jsontext.Value) error
- func (b *Backend) UpdateRoleDefinition(id string, body map[string]jsontext.Value) error
- func (b *Backend) UpdateServicePrincipal(r Ref, body map[string]jsontext.Value) error
- func (b *Backend) UpdateUser(r Ref, body map[string]jsontext.Value) error
- type ClientAuthError
- type ConfigProvider
- type DeletedObject
- type DeltaPage
- type Device
- type Error
- type FederatedCredential
- type Group
- type Handler
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) InProcessToken() (string, error)
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Shutdown(ctx context.Context)
- func (h *Handler) Snapshot(ctx context.Context) []byte
- func (h *Handler) StartWorker(ctx context.Context) error
- type ImplicitGrantSettings
- type KeyCredential
- type KeyResolver
- type OAuth2PermissionGrant
- type Object
- type Option
- type PasswordCredential
- type PasswordProfile
- type PermissionScope
- type PreAuthorizedApplication
- type Provider
- type RedirectFacet
- type Ref
- type RequiredResourceAccess
- type ResourceAccess
- type RoleAssignment
- type RoleDefinition
- type RoleMemberInfo
- type RolePermission
- type ScopedRoleMembership
- type ServicePrincipal
- type Settings
- type User
- type WebApplication
Constants ¶
const DefaultDomain = "gopherstack.onmicrosoft.com"
DefaultDomain is the tenant's initial, default verified domain.
const DefaultPort = 10014
DefaultPort is the Microsoft Graph HTTPS listener.
const DefaultTenantID = "00000000-0000-0000-0000-000000000000"
DefaultTenantID is the dev tenant; it must equal --azure-arm-tenant-id for tokens to validate.
const MicrosoftGraphAppID = "00000003-0000-0000-c000-000000000000"
MicrosoftGraphAppID is the well-known application ID of the Microsoft Graph resource service principal.
Variables ¶
var ErrNilAppContext = errors.New("azuregraph: nil app context")
ErrNilAppContext is returned by Provider.Init for a nil AppContext.
Functions ¶
This section is empty.
Types ¶
type APIApplication ¶
type APIApplication struct {
AcceptMappedClaims *bool `json:"acceptMappedClaims"`
RequestedAccessTokenVersion *int `json:"requestedAccessTokenVersion"`
KnownClientApplications []string `json:"knownClientApplications"`
OAuth2PermissionScopes []PermissionScope `json:"oauth2PermissionScopes"`
PreAuthorizedApplications []PreAuthorizedApplication `json:"preAuthorizedApplications"`
}
APIApplication is the application's api facet.
type AdministrativeUnit ¶
type AdministrativeUnit struct {
DeletedDateTime *time.Time `json:"deletedDateTime"`
IsMemberManagementRestricted *bool `json:"isMemberManagementRestricted"`
Visibility *string `json:"visibility"`
MembershipType *string `json:"membershipType"`
MembershipRule *string `json:"membershipRule"`
MembershipRuleProcessingState *string `json:"membershipRuleProcessingState"`
Description *string `json:"description"`
ID string `json:"id"`
DisplayName string `json:"displayName"`
}
AdministrativeUnit is a Microsoft Entra administrative unit.
type AlternativeSecurityID ¶
type AlternativeSecurityID struct {
IdentityProvider *string `json:"identityProvider"`
Key string `json:"key"`
Type int `json:"type"`
}
AlternativeSecurityID is a device alternativeSecurityId (internal use only in Graph).
type AppRole ¶
type AppRole struct {
ID string `json:"id"`
Description string `json:"description,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Origin string `json:"origin,omitempty"`
Value string `json:"value,omitempty"`
AllowedMemberTypes []string `json:"allowedMemberTypes"`
IsEnabled bool `json:"isEnabled"`
}
AppRole is an appRoles entry.
type AppRoleAssignment ¶
type AppRoleAssignment struct {
CreatedDateTime time.Time `json:"createdDateTime"`
ID string `json:"id"`
AppRoleID string `json:"appRoleId"`
PrincipalID string `json:"principalId"`
PrincipalType string `json:"principalType"`
PrincipalDisplayName string `json:"principalDisplayName"`
ResourceID string `json:"resourceId"`
ResourceDisplayName string `json:"resourceDisplayName"`
}
AppRoleAssignment grants an app role of a resource service principal to a principal.
type Application ¶
type Application struct {
CreatedDateTime time.Time `json:"createdDateTime"`
IsDeviceOnlyAuthSupported *bool `json:"isDeviceOnlyAuthSupported"`
ServiceManagementReference string `json:"serviceManagementReference,omitempty"`
Notes string `json:"notes,omitempty"`
ApplicationTemplateID string `json:"applicationTemplateId,omitempty"`
PublisherDomain string `json:"publisherDomain"`
SAMLMetadataURL string `json:"samlMetadataUrl,omitempty"`
DefaultRedirectURI string `json:"defaultRedirectUri,omitempty"`
AppID string `json:"appId"`
TokenEncryptionKeyID string `json:"tokenEncryptionKeyId,omitempty"`
ID string `json:"id"`
GroupMembershipClaims string `json:"groupMembershipClaims,omitempty"`
SignInAudience string `json:"signInAudience"`
UniqueName string `json:"uniqueName,omitempty"`
DisplayName string `json:"displayName"`
Description string `json:"description,omitempty"`
API APIApplication `json:"api"`
Certification jsontext.Value `json:"certification,omitempty"`
VerifiedPublisher jsontext.Value `json:"verifiedPublisher,omitempty"`
SPA RedirectFacet `json:"spa"`
DisabledByMicrosoftStatus jsontext.Value `json:"disabledByMicrosoftStatus,omitempty"`
AddIns jsontext.Value `json:"addIns,omitempty"`
ParentalControlSettings jsontext.Value `json:"parentalControlSettings,omitempty"`
Info jsontext.Value `json:"info,omitempty"`
OptionalClaims jsontext.Value `json:"optionalClaims,omitempty"`
AuthenticationBehaviors jsontext.Value `json:"authenticationBehaviors,omitempty"`
PublicClient RedirectFacet `json:"publicClient"`
IdentifierURIs []string `json:"identifierUris"`
Tags []string `json:"tags"`
AppRoles []AppRole `json:"appRoles"`
RequiredResourceAccess []RequiredResourceAccess `json:"requiredResourceAccess"`
PasswordCredentials []PasswordCredential `json:"passwordCredentials"`
KeyCredentials []KeyCredential `json:"keyCredentials"`
Web WebApplication `json:"web"`
IsFallbackPublicClient bool `json:"isFallbackPublicClient"`
OAuth2RequirePostResponse bool `json:"oauth2RequirePostResponse"`
}
Application is an application registration.
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is the in-memory directory shared by the Graph listener and the ARM token endpoint.
func NewBackend ¶
NewBackend returns a directory seeded with the Microsoft Graph service principal.
func (*Backend) ActivateDirectoryRole ¶
ActivateDirectoryRole activates a directory role from a built-in template.
func (*Backend) AddAdministrativeUnitMember ¶
AddAdministrativeUnitMember adds a user or group to an administrative unit.
func (*Backend) AddDirectoryRoleMember ¶
AddDirectoryRoleMember assigns the role to a principal at tenant scope.
func (*Backend) AddKey ¶
func (b *Backend) AddKey(id string, in KeyCredential, proof string) (KeyCredential, error)
AddKey registers a key credential and retains the certificate. When the holder already has a valid certificate the proof JWT must be signed by one of them. Graph documents addKey as unavailable until a first certificate exists; the emulator accepts that first key without proof so the call can bootstrap.
func (*Backend) AddPassword ¶
func (b *Backend) AddPassword(id string, in PasswordCredential) (PasswordCredential, error)
AddPassword adds a client secret to an application or service principal. The returned credential carries SecretText; it is the only time the secret is available.
func (*Backend) AddScopedRoleMember ¶
func (b *Backend) AddScopedRoleMember(auID string, body map[string]jsontext.Value) (ScopedRoleMembership, error)
AddScopedRoleMember assigns an activated directory role to a user with the administrative unit as scope.
func (*Backend) AdministrativeUnitMembers ¶
AdministrativeUnitMembers lists the members of an administrative unit.
func (*Backend) AuthenticateAssertion ¶
func (b *Backend) AuthenticateAssertion(clientID, assertion string, audiences []string) (string, bool, error)
AuthenticateAssertion verifies a JWT client assertion for clientID. audiences are the aud values accepted for a certificate assertion (the token endpoint and issuer URLs). known is false for a client the directory does not know. An assertion whose iss and sub are the client ID is a certificate assertion, checked against the stored keyCredentials; any other is matched against the application's federated identity credentials.
func (*Backend) AuthenticateClient ¶
AuthenticateClient checks a client-credentials request against the registered applications. known is false for a client ID no application or service principal uses, leaving the caller free to apply its own policy. On success objectID is the service principal's object ID, the token's oid claim.
func (*Backend) AuthenticateUser ¶
AuthenticateUser verifies a resource-owner password sign-in and returns the user's object ID and user principal name. Repeated failures lock the account for a minute on the backend clock (Learn: howto-password-smart-lockout defaults); as in Entra, anyone who knows a user's name can trigger that lockout.
func (*Backend) ByIDs ¶
ByIDs resolves object IDs, optionally restricted to kinds ("user", "group", ... or "directoryObject").
func (*Backend) CreateAdministrativeUnit ¶
func (b *Backend) CreateAdministrativeUnit(body map[string]jsontext.Value) (AdministrativeUnit, error)
CreateAdministrativeUnit creates an administrative unit.
func (*Backend) CreateAppRoleAssignment ¶
func (b *Backend) CreateAppRoleAssignment( ownerID string, asResource bool, body map[string]jsontext.Value, ) (AppRoleAssignment, error)
CreateAppRoleAssignment grants an app role. ownerID is the path service principal, user or group; asResource selects appRoleAssignedTo (owner is the resource) over appRoleAssignments (owner is the principal).
func (*Backend) CreateApplication ¶
CreateApplication registers an application.
func (*Backend) CreateDevice ¶
CreateDevice registers a device.
func (*Backend) CreateFederatedCredential ¶
func (b *Backend) CreateFederatedCredential( appID string, body map[string]jsontext.Value, ) (FederatedCredential, error)
CreateFederatedCredential adds a federated identity credential to an application.
func (*Backend) CreateGrant ¶
CreateGrant records a delegated permission grant.
func (*Backend) CreateGroup ¶
CreateGroup creates a group; members@odata.bind and owners@odata.bind add references atomically.
func (*Backend) CreateRoleAssignment ¶
CreateRoleAssignment assigns a built-in directory role to a user, role-assignable group or service principal.
func (*Backend) CreateRoleDefinition ¶
CreateRoleDefinition creates a custom role definition.
func (*Backend) CreateServicePrincipal ¶
CreateServicePrincipal instantiates an application in the tenant; body.appId must name a registered application.
func (*Backend) CreateUser ¶
CreateUser creates a user; only a salted hash of the passwordProfile password is kept.
func (*Backend) DeleteAdministrativeUnit ¶
DeleteAdministrativeUnit removes an administrative unit with its membership and scoped role members.
func (*Backend) DeleteAppRoleAssignment ¶
DeleteAppRoleAssignment removes an assignment owned by id.
func (*Backend) DeleteApplication ¶
DeleteApplication soft-deletes an application together with its service principal.
func (*Backend) DeleteDevice ¶
DeleteDevice permanently removes a device and its registered owner and user links; Learn lists no soft delete.
func (*Backend) DeleteFederatedCredential ¶
DeleteFederatedCredential removes a credential.
func (*Backend) DeleteGrant ¶
DeleteGrant removes a grant.
func (*Backend) DeleteGroup ¶
DeleteGroup removes a group.
func (*Backend) DeleteRoleAssignment ¶
DeleteRoleAssignment removes a role assignment.
func (*Backend) DeleteRoleDefinition ¶
DeleteRoleDefinition soft-deletes a custom role definition that has no assignments.
func (*Backend) DeleteServicePrincipal ¶
DeleteServicePrincipal removes a service principal.
func (*Backend) DirectReports ¶
DirectReports lists the users whose manager is the given user.
func (*Backend) DirectoryRoleMembers ¶
DirectoryRoleMembers lists the principals holding the role at tenant scope.
func (*Backend) DirectoryRoles ¶
DirectoryRoles lists the activated directory roles.
func (*Backend) GetAdministrativeUnit ¶
func (b *Backend) GetAdministrativeUnit(r Ref) (AdministrativeUnit, error)
GetAdministrativeUnit returns an administrative unit.
func (*Backend) GetApplication ¶
func (b *Backend) GetApplication(r Ref) (Application, error)
GetApplication returns an application.
func (*Backend) GetDeleted ¶
func (b *Backend) GetDeleted(id string) (DeletedObject, error)
GetDeleted returns one soft-deleted object.
func (*Backend) GetDeletedRoleDefinition ¶
func (b *Backend) GetDeletedRoleDefinition(id string) (RoleDefinition, error)
GetDeletedRoleDefinition returns a soft-deleted custom role definition.
func (*Backend) GetDirectoryRole ¶
GetDirectoryRole returns an activated role by ID or roleTemplateId.
func (*Backend) GetFederatedCredential ¶
func (b *Backend) GetFederatedCredential(appID, key string) (FederatedCredential, error)
GetFederatedCredential returns one credential by ID or name.
func (*Backend) GetRoleAssignment ¶
func (b *Backend) GetRoleAssignment(id string) (RoleAssignment, error)
GetRoleAssignment returns one role assignment.
func (*Backend) GetRoleDefinition ¶
func (b *Backend) GetRoleDefinition(id string) (RoleDefinition, error)
GetRoleDefinition returns one active role definition.
func (*Backend) GetServicePrincipal ¶
func (b *Backend) GetServicePrincipal(r Ref) (ServicePrincipal, error)
GetServicePrincipal returns a service principal.
func (*Backend) ListAdministrativeUnits ¶
func (b *Backend) ListAdministrativeUnits() []AdministrativeUnit
ListAdministrativeUnits returns every administrative unit in creation order.
func (*Backend) ListAppRoleAssignments ¶
func (b *Backend) ListAppRoleAssignments(id string, asResource bool) ([]AppRoleAssignment, error)
ListAppRoleAssignments lists assignments where id is the principal, or (asResource) the resource.
func (*Backend) ListApplications ¶
func (b *Backend) ListApplications() []Application
ListApplications returns every application in creation order.
func (*Backend) ListDeleted ¶
func (b *Backend) ListDeleted(kind string) []DeletedObject
ListDeleted returns the soft-deleted objects of a kind (all kinds when kind is empty).
func (*Backend) ListDevices ¶
ListDevices returns every device in creation order.
func (*Backend) ListFederatedCredentials ¶
func (b *Backend) ListFederatedCredentials(appID string) ([]FederatedCredential, error)
ListFederatedCredentials lists an application's federated identity credentials.
func (*Backend) ListGrants ¶
func (b *Backend) ListGrants() []OAuth2PermissionGrant
ListGrants returns every delegated permission grant.
func (*Backend) ListGroups ¶
ListGroups returns every group in creation order.
func (*Backend) ListRoleAssignments ¶
func (b *Backend) ListRoleAssignments() []RoleAssignment
ListRoleAssignments returns every directory role assignment.
func (*Backend) ListRoleDefinitions ¶
func (b *Backend) ListRoleDefinitions() []RoleDefinition
ListRoleDefinitions returns the built-in and active custom role definitions.
func (*Backend) ListServicePrincipals ¶
func (b *Backend) ListServicePrincipals() []ServicePrincipal
ListServicePrincipals returns every service principal in creation order.
func (*Backend) MemberOf ¶
MemberOf lists the groups id belongs to, directly or (transitive) through nesting.
func (*Backend) ObjectKind ¶
ObjectKind reports whether id names a directory object and its kind.
func (*Backend) PermanentDelete ¶
PermanentDelete removes a soft-deleted object for good.
func (*Backend) PermanentDeleteRoleDefinition ¶
PermanentDeleteRoleDefinition removes a soft-deleted custom role definition for good.
func (*Backend) PrincipalType ¶
PrincipalType reports whether id is a user, group or service principal and returns its role-assignment principal type (User, Group or ServicePrincipal).
func (*Backend) RemoveAdministrativeUnitMember ¶
RemoveAdministrativeUnitMember removes a member from an administrative unit.
func (*Backend) RemoveDirectoryRoleMember ¶
RemoveDirectoryRoleMember removes a principal's tenant-scope assignment of the role.
func (*Backend) RemoveManager ¶
RemoveManager clears the user's manager.
func (*Backend) RemoveMember ¶
RemoveMember removes a group member reference.
func (*Backend) RemoveOwner ¶
RemoveOwner removes an owner reference.
func (*Backend) RemovePassword ¶
RemovePassword deletes a client secret.
func (*Backend) RemoveScopedRoleMember ¶
RemoveScopedRoleMember deletes one scoped role membership.
func (*Backend) Reset ¶
func (b *Backend) Reset()
Reset drops all state and re-seeds the built-in service principals.
func (*Backend) RestoreDeleted ¶
RestoreDeleted moves a soft-deleted object back into the directory with its own owners, members, credentials and (for a user) group memberships. References from other objects to it are gone, as are its app role assignments and grants.
func (*Backend) RestoreRoleDefinition ¶
func (b *Backend) RestoreRoleDefinition(id string) (RoleDefinition, error)
RestoreRoleDefinition moves a soft-deleted custom role definition back to the active set.
func (*Backend) ScopedRoleMembers ¶
func (b *Backend) ScopedRoleMembers(auID string) ([]ScopedRoleMembership, error)
ScopedRoleMembers lists the scoped role members of an administrative unit.
func (*Backend) SetIssuerKeys ¶
func (b *Backend) SetIssuerKeys(r KeyResolver)
SetIssuerKeys lets federated identity credential assertions signed by an emulator-run OIDC issuer be verified in-process. Assertions whose kid the resolver does not know are matched by claims only.
func (*Backend) SetManager ¶
SetManager assigns managerID as the manager of the user; only users can be managers and chains cannot loop.
func (*Backend) Snapshot ¶
Snapshot implements persistence.Persistable. Secrets are salted PBKDF2 hashes; plaintext is never stored.
func (*Backend) TransitiveMembers ¶
TransitiveMembers lists a group's members including those of nested groups.
func (*Backend) UpdateAdministrativeUnit ¶
UpdateAdministrativeUnit applies a PATCH body.
func (*Backend) UpdateApplication ¶
UpdateApplication applies a PATCH body.
func (*Backend) UpdateDevice ¶
UpdateDevice applies a PATCH body; only the properties Learn lists as writable are accepted.
func (*Backend) UpdateFederatedCredential ¶
func (b *Backend) UpdateFederatedCredential(appID, key string, body map[string]jsontext.Value) error
UpdateFederatedCredential patches a credential; its name is immutable.
func (*Backend) UpdateGrant ¶
UpdateGrant changes the scope of a grant.
func (*Backend) UpdateGroup ¶
UpdateGroup applies a PATCH body. isAssignableToRole can only be set at creation.
func (*Backend) UpdateRoleDefinition ¶
UpdateRoleDefinition applies a PATCH body to a custom role definition.
func (*Backend) UpdateServicePrincipal ¶
UpdateServicePrincipal applies a PATCH body.
type ClientAuthError ¶
ClientAuthError is an Entra token endpoint failure for a client-credentials request.
func (*ClientAuthError) Error ¶
func (e *ClientAuthError) Error() string
type ConfigProvider ¶
type ConfigProvider interface {
GetAzureGraphSettings() Settings
}
ConfigProvider extracts the Microsoft Graph settings from the AppContext config.
type DeletedObject ¶
DeletedObject is a soft-deleted directory object.
type Device ¶
type Device struct {
RegistrationDateTime time.Time `json:"registrationDateTime"`
ApproximateLastSignInDateTime *time.Time `json:"approximateLastSignInDateTime"`
ComplianceExpirationDateTime *time.Time `json:"complianceExpirationDateTime"`
OnPremisesSyncEnabled *bool `json:"onPremisesSyncEnabled"`
IsCompliant *bool `json:"isCompliant"`
IsManaged *bool `json:"isManaged"`
IsRooted *bool `json:"isRooted"`
DeviceMetadata *string `json:"deviceMetadata"`
DeviceVersion *int `json:"deviceVersion"`
ID string `json:"id"`
DeviceID string `json:"deviceId"`
DisplayName string `json:"displayName"`
DeviceCategory string `json:"deviceCategory,omitempty"`
DeviceOwnership string `json:"deviceOwnership,omitempty"`
EnrollmentProfileName string `json:"enrollmentProfileName,omitempty"`
EnrollmentType string `json:"enrollmentType,omitempty"`
ManagementType string `json:"managementType,omitempty"`
Manufacturer string `json:"manufacturer,omitempty"`
MDMAppID string `json:"mdmAppId,omitempty"`
Model string `json:"model,omitempty"`
OperatingSystem string `json:"operatingSystem"`
OperatingSystemVersion string `json:"operatingSystemVersion"`
ProfileType string `json:"profileType,omitempty"`
TrustType string `json:"trustType,omitempty"`
AlternativeSecurityIDs []AlternativeSecurityID `json:"alternativeSecurityIds"`
PhysicalIDs []string `json:"physicalIds"`
SystemLabels []string `json:"systemLabels"`
AccountEnabled bool `json:"accountEnabled"`
}
Device is a registered or joined device.
type FederatedCredential ¶
type FederatedCredential struct {
Description *string `json:"description"`
ID string `json:"id"`
Name string `json:"name"`
Issuer string `json:"issuer"`
Subject string `json:"subject"`
Audiences []string `json:"audiences"`
}
FederatedCredential is an application's federatedIdentityCredential.
type Group ¶
type Group struct {
CreatedDateTime time.Time `json:"createdDateTime"`
IsAssignableToRole *bool `json:"isAssignableToRole"`
MembershipRule string `json:"membershipRule,omitempty"`
MembershipRuleProcessingState string `json:"membershipRuleProcessingState,omitempty"`
MailNickname string `json:"mailNickname"`
Mail string `json:"mail,omitempty"`
Visibility string `json:"visibility,omitempty"`
Classification string `json:"classification,omitempty"`
DisplayName string `json:"displayName"`
Description string `json:"description,omitempty"`
PreferredDataLocation string `json:"preferredDataLocation,omitempty"`
ID string `json:"id"`
ResourceBehaviorOptions []string `json:"resourceBehaviorOptions"`
ResourceProvisioningOptions []string `json:"resourceProvisioningOptions"`
GroupTypes []string `json:"groupTypes"`
MailEnabled bool `json:"mailEnabled"`
SecurityEnabled bool `json:"securityEnabled"`
}
Group is a security, Microsoft 365 or distribution group.
type Handler ¶
type Handler struct {
Backend *Backend
// Issuer verifies bearer tokens when Settings.ValidateTokens is set; cli wiring shares ARM's issuer.
Issuer *aadauth.Issuer
// Settings holds the listener configuration.
Settings Settings
// Port is the fixed TCP port StartWorker binds.
Port int
// contains filtered or unexported fields
}
Handler serves Microsoft Graph v1.0 directory APIs on a dedicated HTTPS listener.
func NewHandler ¶
NewHandler creates a Handler.
func (*Handler) ExtractOperation ¶
ExtractOperation names the operation for metrics.
func (*Handler) ExtractResource ¶
ExtractResource returns the request path for metrics.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations lists the operation names ExtractOperation can return.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler for the Graph API.
func (*Handler) InProcessToken ¶
InProcessToken mints a short-lived bearer token this handler accepts, for callers in the same process that never see the listener. The token has no oid, so objects created with it get no owner.
func (*Handler) MatchPriority ¶
MatchPriority is irrelevant because RouteMatcher never matches.
func (*Handler) RouteMatcher ¶
RouteMatcher never matches: Microsoft Graph runs on its own listener.
type ImplicitGrantSettings ¶
type ImplicitGrantSettings struct {
EnableAccessTokenIssuance bool `json:"enableAccessTokenIssuance"`
EnableIDTokenIssuance bool `json:"enableIdTokenIssuance"`
}
ImplicitGrantSettings is web.implicitGrantSettings.
type KeyCredential ¶
type KeyCredential struct {
StartDateTime time.Time `json:"startDateTime"`
EndDateTime time.Time `json:"endDateTime"`
Key *string `json:"key"`
CustomKeyIdentifier *string `json:"customKeyIdentifier"`
DisplayName *string `json:"displayName"`
KeyID string `json:"keyId"`
Type string `json:"type"`
Usage string `json:"usage"`
}
KeyCredential is a certificate or key credential; the key material is never returned.
type KeyResolver ¶
KeyResolver returns the public key of an emulator-run OIDC issuer for a JWT key ID.
type OAuth2PermissionGrant ¶
type OAuth2PermissionGrant struct {
ID string `json:"id"`
ClientID string `json:"clientId"`
ConsentType string `json:"consentType"`
PrincipalID string `json:"principalId,omitempty"`
ResourceID string `json:"resourceId"`
Scope string `json:"scope"`
}
OAuth2PermissionGrant is a delegated permission grant.
type Object ¶
Object is a directory object of any kind with its entity (Application, ServicePrincipal, User or Group).
type PasswordCredential ¶
type PasswordCredential struct {
StartDateTime time.Time `json:"startDateTime"`
EndDateTime time.Time `json:"endDateTime"`
SecretText *string `json:"secretText"`
CustomKeyIdentifier *string `json:"customKeyIdentifier"`
DisplayName *string `json:"displayName"`
Hint *string `json:"hint"`
KeyID string `json:"keyId"`
}
PasswordCredential is a client secret; SecretText is only set in the addPassword response.
type PasswordProfile ¶
type PasswordProfile struct {
Password string `json:"password"`
ForceChangePasswordNextSignIn bool `json:"forceChangePasswordNextSignIn"`
ForceChangePasswordNextMFA bool `json:"forceChangePasswordNextSignInWithMfa"`
}
PasswordProfile is accepted on write and never returned.
type PermissionScope ¶
type PermissionScope struct {
ID string `json:"id"`
AdminConsentDescription string `json:"adminConsentDescription,omitempty"`
AdminConsentDisplayName string `json:"adminConsentDisplayName,omitempty"`
Type string `json:"type,omitempty"`
UserConsentDescription string `json:"userConsentDescription,omitempty"`
UserConsentDisplayName string `json:"userConsentDisplayName,omitempty"`
Value string `json:"value,omitempty"`
IsEnabled bool `json:"isEnabled"`
}
PermissionScope is an api.oauth2PermissionScopes entry.
type PreAuthorizedApplication ¶
type PreAuthorizedApplication struct {
AppID string `json:"appId"`
DelegatedPermissionIDs []string `json:"delegatedPermissionIds"`
}
PreAuthorizedApplication is an api.preAuthorizedApplications entry.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for Microsoft Graph.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init builds the backend and handler; the port is bound by Handler.StartWorker.
type RedirectFacet ¶
type RedirectFacet struct {
RedirectURIs []string `json:"redirectUris"`
}
RedirectFacet carries redirectUris for the spa and publicClient facets.
type RequiredResourceAccess ¶
type RequiredResourceAccess struct {
ResourceAppID string `json:"resourceAppId"`
ResourceAccess []ResourceAccess `json:"resourceAccess"`
}
RequiredResourceAccess declares the permissions an application needs from one resource.
type ResourceAccess ¶
ResourceAccess is a requiredResourceAccess.resourceAccess entry.
type RoleAssignment ¶
type RoleAssignment struct {
AppScopeID *string `json:"appScopeId"`
Condition *string `json:"condition"`
ID string `json:"id"`
PrincipalID string `json:"principalId"`
RoleDefinitionID string `json:"roleDefinitionId"`
DirectoryScopeID string `json:"directoryScopeId"`
}
RoleAssignment is a unifiedRoleAssignment of the Entra directory role management API.
type RoleDefinition ¶
type RoleDefinition struct {
DeletedDateTime *time.Time `json:"deletedDateTime"`
Version *string `json:"version"`
ID string `json:"id"`
TemplateID string `json:"templateId"`
DisplayName string `json:"displayName"`
Description string `json:"description"`
ResourceScopes []string `json:"resourceScopes"`
RolePermissions []RolePermission `json:"rolePermissions"`
IsBuiltIn bool `json:"isBuiltIn"`
IsEnabled bool `json:"isEnabled"`
}
RoleDefinition is a unifiedRoleDefinition; built-in roles are derived from the template catalog.
type RoleMemberInfo ¶
type RoleMemberInfo struct {
ID string `json:"id"`
DisplayName string `json:"displayName"`
UserPrincipalName string `json:"userPrincipalName"`
}
RoleMemberInfo identifies the principal of a scopedRoleMembership.
type RolePermission ¶
type RolePermission struct {
Condition *string `json:"condition"`
AllowedResourceActions []string `json:"allowedResourceActions"`
}
RolePermission is a unifiedRolePermission.
type ScopedRoleMembership ¶
type ScopedRoleMembership struct {
RoleMemberInfo RoleMemberInfo `json:"roleMemberInfo"`
ID string `json:"id"`
AdministrativeUnitID string `json:"administrativeUnitId"`
RoleID string `json:"roleId"`
}
ScopedRoleMembership assigns a directory role to a user within one administrative unit.
type ServicePrincipal ¶
type ServicePrincipal struct {
AddIns jsontext.Value `json:"addIns,omitempty"`
DisabledByMicrosoftStatus jsontext.Value `json:"disabledByMicrosoftStatus,omitempty"`
ResourceSpecificPermissions jsontext.Value `json:"resourceSpecificApplicationPermissions,omitempty"`
PasswordSSOSettings jsontext.Value `json:"passwordSingleSignOnSettings,omitempty"`
PreferredKeyEndDateTime jsontext.Value `json:"preferredTokenSigningKeyEndDateTime,omitempty"`
CustomSecurityAttributes jsontext.Value `json:"customSecurityAttributes,omitempty"`
SAMLMetadataURL string `json:"samlMetadataUrl,omitempty"`
ApplicationTemplateID string `json:"applicationTemplateId,omitempty"`
CreatedDateTime time.Time `json:"createdDateTime"`
Info jsontext.Value `json:"info,omitempty"`
VerifiedPublisher jsontext.Value `json:"verifiedPublisher,omitempty"`
SAMLSingleSignOnSettings jsontext.Value `json:"samlSingleSignOnSettings,omitempty"`
ID string `json:"id"`
AppID string `json:"appId"`
DisplayName string `json:"displayName"`
AppDisplayName string `json:"appDisplayName"`
AppDescription string `json:"appDescription,omitempty"`
AppOwnerOrganizationID string `json:"appOwnerOrganizationId,omitempty"`
Description string `json:"description,omitempty"`
LoginURL string `json:"loginUrl,omitempty"`
LogoutURL string `json:"logoutUrl,omitempty"`
Homepage string `json:"homepage,omitempty"`
Notes string `json:"notes,omitempty"`
PreferredSingleSignOnMode string `json:"preferredSingleSignOnMode,omitempty"`
PreferredTokenSigningKeyThumb string `json:"preferredTokenSigningKeyThumbprint,omitempty"`
ServicePrincipalType string `json:"servicePrincipalType"`
SignInAudience string `json:"signInAudience"`
TokenEncryptionKeyID string `json:"tokenEncryptionKeyId,omitempty"`
AlternativeNames []string `json:"alternativeNames"`
NotificationEmailAddresses []string `json:"notificationEmailAddresses"`
ReplyURLs []string `json:"replyUrls"`
ServicePrincipalNames []string `json:"servicePrincipalNames"`
Tags []string `json:"tags"`
AppRoles []AppRole `json:"appRoles"`
OAuth2PermissionScopes []PermissionScope `json:"oauth2PermissionScopes"`
PasswordCredentials []PasswordCredential `json:"passwordCredentials"`
KeyCredentials []KeyCredential `json:"keyCredentials"`
AccountEnabled bool `json:"accountEnabled"`
AppRoleAssignmentRequired bool `json:"appRoleAssignmentRequired"`
}
ServicePrincipal is the local instance of an application in the tenant.
type Settings ¶
type Settings struct {
TLSCertFile string `` //nolint:lll // config struct tags are intentionally verbose
/* 241-byte string literal not displayed */
TLSKeyFile string `` //nolint:lll // config struct tags are intentionally verbose
/* 138-byte string literal not displayed */
TenantID string `` //nolint:lll // config struct tags are intentionally verbose
/* 288-byte string literal not displayed */
DefaultDomain string `` //nolint:lll // config struct tags are intentionally verbose
/* 279-byte string literal not displayed */
DevClientID string `` //nolint:lll // config struct tags are intentionally verbose
/* 288-byte string literal not displayed */
ExtraDomains string `` //nolint:lll // config struct tags are intentionally verbose
/* 130-byte string literal not displayed */
Port int `` //nolint:lll // config struct tags are intentionally verbose
/* 257-byte string literal not displayed */
ValidateTokens bool `` //nolint:lll // config struct tags are intentionally verbose
/* 257-byte string literal not displayed */
}
Settings is the Kong-embedded configuration of the Microsoft Graph emulator.
func DefaultSettings ¶
func DefaultSettings() Settings
DefaultSettings returns the settings used when no ConfigProvider exists.
type User ¶
type User struct {
CreatedDateTime time.Time `json:"createdDateTime"`
PasswordProfile *PasswordProfile `json:"passwordProfile,omitempty"`
ID string `json:"id"`
UserPrincipalName string `json:"userPrincipalName"`
DisplayName string `json:"displayName"`
MailNickname string `json:"mailNickname"`
GivenName string `json:"givenName,omitempty"`
Surname string `json:"surname,omitempty"`
Mail string `json:"mail,omitempty"`
JobTitle string `json:"jobTitle,omitempty"`
Department string `json:"department,omitempty"`
CompanyName string `json:"companyName,omitempty"`
OfficeLocation string `json:"officeLocation,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
Country string `json:"country,omitempty"`
StreetAddress string `json:"streetAddress,omitempty"`
PostalCode string `json:"postalCode,omitempty"`
MobilePhone string `json:"mobilePhone,omitempty"`
PreferredLanguage string `json:"preferredLanguage,omitempty"`
UsageLocation string `json:"usageLocation,omitempty"`
EmployeeID string `json:"employeeId,omitempty"`
PasswordPolicies string `json:"passwordPolicies,omitempty"`
OnPremImmutableID string `json:"onPremisesImmutableId,omitempty"`
UserType string `json:"userType"`
BusinessPhones []string `json:"businessPhones"`
OtherMails []string `json:"otherMails"`
AccountEnabled bool `json:"accountEnabled"`
}
User is a directory user.
type WebApplication ¶
type WebApplication struct {
HomePageURL string `json:"homePageUrl"`
LogoutURL string `json:"logoutUrl"`
RedirectURIs []string `json:"redirectUris"`
ImplicitGrantSettings ImplicitGrantSettings `json:"implicitGrantSettings"`
}
WebApplication is the application's web facet.
Source Files
¶
- adminunits.go
- apps.go
- assign.go
- backend.go
- batch.go
- bounds.go
- certauth.go
- collections.go
- consts.go
- creds.go
- deleted_routes.go
- delta.go
- devices.go
- directoryroles.go
- errors.go
- expand.go
- fic.go
- filter.go
- groups.go
- handler.go
- inproc.go
- keypatch.go
- manager.go
- model.go
- opnames.go
- password.go
- patch.go
- persistence.go
- provider.go
- query.go
- relations.go
- roledefs.go
- rolemgmt.go
- routes.go
- routes_sub.go
- seed.go
- settings.go
- softdelete.go
- sps.go
- store.go
- users.go