Documentation
¶
Index ¶
- Constants
- type Application
- type Client
- func (c *Client) AddPassword(ctx context.Context, appID, displayName string, startTime, endTime time.Time) (*PasswordCredential, error)
- func (c *Client) CreateApplication(ctx context.Context, displayName string, redirectURIs []string) (*Application, error)
- func (c *Client) CreateServicePrincipal(ctx context.Context, appId string) (*ServicePrincipal, error)
- func (c *Client) DeleteApplication(ctx context.Context, appID string) error
- func (c *Client) GetApplication(ctx context.Context, appID string) (*Application, error)
- func (c *Client) GetGraphClient() *graphsdk.GraphBaseServiceClient
- func (c *Client) ListOwnedExpiredApplications(ctx context.Context) ([]Application, error)
- func (c *Client) UpdateApplicationRedirectUris(ctx context.Context, appID string, redirectURIs []string) error
- type PasswordCredential
- type ServicePrincipal
Constants ¶
const AppRegistrationPrefix = "aro-hcp-e2e-"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct {
ID string `json:"id"`
AppID string `json:"appId"`
DisplayName string `json:"displayName"`
}
Application represents a Microsoft Entra application
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the Microsoft Graph SDK with authentication and common operations
func NewClient ¶
NewClient creates a new Graph client with automatic authentication. It inspects the token to determine whether the credential represents a user or a service principal, which affects which Graph API endpoints are used.
func (*Client) AddPassword ¶
func (c *Client) AddPassword(ctx context.Context, appID, displayName string, startTime, endTime time.Time) (*PasswordCredential, error)
AddPassword adds a password credential to an application. Eventual consistency of MSGraph means sometimes you have to wait until the application is fully propagated before adding a password credential.
func (*Client) CreateApplication ¶
func (c *Client) CreateApplication(ctx context.Context, displayName string, redirectURIs []string) (*Application, error)
CreateApplication creates a new Microsoft Entra application with requestedAccessTokenVersion=2 to allow token issuance from login.microsoftonline.com
func (*Client) CreateServicePrincipal ¶
func (c *Client) CreateServicePrincipal(ctx context.Context, appId string) (*ServicePrincipal, error)
CreateServicePrincipal creates a new Microsoft Entra service principal
func (*Client) DeleteApplication ¶
DeleteApplication deletes an application
func (*Client) GetApplication ¶
GetApplication retrieves an application by ID
func (*Client) GetGraphClient ¶
func (c *Client) GetGraphClient() *graphsdk.GraphBaseServiceClient
GetGraphClient returns the underlying Graph SDK client for advanced operations
func (*Client) ListOwnedExpiredApplications ¶
func (c *Client) ListOwnedExpiredApplications(ctx context.Context) ([]Application, error)
ListOwnedExpiredApplications retrieves applications owned by the current caller where all their credentials have expired and a display name starting with the e2e prefix. For user credentials, this uses /me/ownedObjects. For service principal credentials, this uses /servicePrincipals/{id}/ownedObjects to ensure we only return applications we have permission to delete.
type PasswordCredential ¶
type PasswordCredential struct {
SecretText string `json:"secretText"`
KeyID string `json:"keyId"`
StartTime time.Time `json:"startTime"`
EndTime time.Time `json:"endTime"`
}
PasswordCredential represents a password credential for an application
type ServicePrincipal ¶
type ServicePrincipal struct {
ID string `json:"id"`
AppID string `json:"appId"`
DisplayName string `json:"displayName"`
}
ServicePrincipal represents a Microsoft Entra service principal