Documentation
¶
Index ¶
- Constants
- type AuthResponse
- type Group
- type GroupList
- type ObjectList
- type ObjectQuery
- type TokenProvider
- func NewAKSTokenProvider(tokenURL, tenantID string) TokenProvider
- func NewClientCredentialTokenProvider(clientID, clientSecret, loginURL, scope string) TokenProvider
- func NewMSITokenProvider(msiAudience, msiEndpoint string) TokenProvider
- func NewOBOTokenProvider(clientID, clientSecret, loginURL, scope string) TokenProvider
- type TokenResponse
- type UserInfo
- func New(clientID, clientSecret, tenantID string, useGroupUID bool, ...) (*UserInfo, error)
- func NewWithAKS(tokenURL, tenantID, msgraphHost string) (*UserInfo, error)
- func NewWithARC(msiAudience, resourceId, tenantId, region string) (*UserInfo, error)
- func NewWithOBO(clientID, clientSecret, tenantID string, aadEndpoint, msgraphHost string) (*UserInfo, error)
- func TestUserInfo(clientID, clientSecret, loginUrl, apiUrl string, useGroupUID bool) (*UserInfo, error)
Constants ¶
const (
MSIEndpointForARC = "http://127.0.0.1:8421/metadata/identity/oauth2/token?api-version=2018-02-01"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthResponse ¶
type AuthResponse struct { TokenType string `json:"token_type"` Expires int `json:"expires_in"` Token string `json:"access_token"` }
AuthResponse represents a response from the MS Graph auth API
type GroupList ¶
type GroupList struct {
Value []Group `json:"value"`
}
GroupList represents a list of groups returned from the MS Graph API
type ObjectList ¶
type ObjectList struct {
Value []string `json:"value"`
}
ObjectList represents a list of directory object IDs returned from the MS Graph API
type ObjectQuery ¶
ObjectQuery represents a query object to the directoryObjects endpoint
type TokenProvider ¶
type TokenProvider interface { Name() string Acquire(ctx context.Context, token string) (AuthResponse, error) }
TokenProvider is an interface to obtain token for MS Graph api
func NewAKSTokenProvider ¶
func NewAKSTokenProvider(tokenURL, tenantID string) TokenProvider
NewAKSTokenProvider returns a TokenProvider that implements On-Behalf-Of flow using AKS first party service
func NewClientCredentialTokenProvider ¶
func NewClientCredentialTokenProvider(clientID, clientSecret, loginURL, scope string) TokenProvider
NewClientCredentialTokenProvider returns a TokenProvider that implements OAuth client credential flow on Azure Active Directory https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow#get-a-token
func NewMSITokenProvider ¶ added in v0.14.0
func NewMSITokenProvider(msiAudience, msiEndpoint string) TokenProvider
NewMSITokenProvider returns a TokenProvider that implements OAuth msi flow on Azure Active Directory
func NewOBOTokenProvider ¶
func NewOBOTokenProvider(clientID, clientSecret, loginURL, scope string) TokenProvider
NewOBOTokenProvider returns a TokenProvider that implements OAuth On-Behalf-Of flow on Azure Active Directory https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow
type TokenResponse ¶ added in v0.14.0
type TokenResponse struct { AccessToken string `json:"access_token"` ExpiresIn string `json:"expires_in"` RefreshToken string `json:"refresh_token"` ExpiresOn string `json:"expires_on"` NotBefore string `json:"not_before"` Resource string `json:"resource"` TokenType string `json:"token_type"` ErrorMessage string `json:"error_message,omitempty"` }
type UserInfo ¶
type UserInfo struct {
// contains filtered or unexported fields
}
UserInfo allows you to get user data from MS Graph
func New ¶
func New(clientID, clientSecret, tenantID string, useGroupUID bool, aadEndpoint, msgraphHost string) (*UserInfo, error)
New returns a new UserInfo object
func NewWithAKS ¶
NewWithAKS returns a new UserInfo object used in AKS
func NewWithARC ¶ added in v0.14.0
NewWithARC returns a new UserInfo object used in ARC
func NewWithOBO ¶
func NewWithOBO(clientID, clientSecret, tenantID string, aadEndpoint, msgraphHost string) (*UserInfo, error)
NewWithOBO returns a new UserInfo object