msalbase

package
v0.0.0-...-a01d22e Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorizationTypeNone                  AuthorizationType = iota
	AuthorizationTypeUsernamePassword                        = iota
	AuthorizationTypeWindowsIntegratedAuth                   = iota
	AuthorizationTypeAuthCode                                = iota
	AuthorizationTypeInteractive                             = iota
	AuthorizationTypeCertificate                             = iota
	AuthorizationTypeDeviceCode                              = iota
	AuthorizationTypeRefreshTokenExchange                    = iota
)

Variables

This section is empty.

Functions

func GetOSPlatform

func GetOSPlatform() string

func GetOSVersion

func GetOSVersion() string

Types

type Account

type Account struct {
}

func CreateAccount

func CreateAccount(homeAccountID string,
	environment string,
	realm string,
	localAccountID string,
	authorityType AuthorityType,
	preferredUsername string,
	givenName string,
	familyName string,
	middleName string,
	name string,
	alternativeID string,
	rawClientInfo string,
	additionalFieldsJSON string) *Account

type AuthParametersInternal

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

func CreateAuthParametersInternal

func CreateAuthParametersInternal(clientID string, authorityInfo *AuthorityInfo) *AuthParametersInternal

func (*AuthParametersInternal) GetAuthorityEndpoints

func (ap *AuthParametersInternal) GetAuthorityEndpoints() *AuthorityEndpoints

func (*AuthParametersInternal) GetAuthorityInfo

func (ap *AuthParametersInternal) GetAuthorityInfo() *AuthorityInfo

func (*AuthParametersInternal) GetAuthorizationType

func (ap *AuthParametersInternal) GetAuthorizationType() AuthorizationType

func (*AuthParametersInternal) GetClientID

func (ap *AuthParametersInternal) GetClientID() string

func (*AuthParametersInternal) GetCorrelationID

func (ap *AuthParametersInternal) GetCorrelationID() string

func (*AuthParametersInternal) GetHomeAccountID

func (ap *AuthParametersInternal) GetHomeAccountID() string

func (*AuthParametersInternal) GetPassword

func (ap *AuthParametersInternal) GetPassword() string

func (*AuthParametersInternal) GetRedirectURI

func (ap *AuthParametersInternal) GetRedirectURI() string

func (*AuthParametersInternal) GetScopes

func (ap *AuthParametersInternal) GetScopes() []string

func (*AuthParametersInternal) GetUsername

func (ap *AuthParametersInternal) GetUsername() string

func (*AuthParametersInternal) SetAuthorityEndpoints

func (ap *AuthParametersInternal) SetAuthorityEndpoints(authorityEndpoints *AuthorityEndpoints)

func (*AuthParametersInternal) SetAuthorizationType

func (ap *AuthParametersInternal) SetAuthorizationType(authType AuthorizationType)

func (*AuthParametersInternal) SetPassword

func (ap *AuthParametersInternal) SetPassword(password string)

func (*AuthParametersInternal) SetScopes

func (ap *AuthParametersInternal) SetScopes(scopes []string)

func (*AuthParametersInternal) SetUsername

func (ap *AuthParametersInternal) SetUsername(username string)

type AuthenticationResult

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

AuthenticationResult contains the results of one token acquisition operation in PublicClientApplication or ConfidentialClientApplication. For details see https://aka.ms/msal-net-authenticationresult

func CreateAuthenticationResult

func CreateAuthenticationResult(tokenResponse *TokenResponse, account *Account) *AuthenticationResult

CreateAuthenticationResult creates and AuthenticationResult. This should only be called from internal code.

func CreateAuthenticationResultFromStorageTokenResponse

func CreateAuthenticationResultFromStorageTokenResponse(storageTokenResponse *StorageTokenResponse) (*AuthenticationResult, error)

func (*AuthenticationResult) GetAccessToken

func (ar *AuthenticationResult) GetAccessToken() string

GetAccessToken retrieves the access token string from the result.

func (*AuthenticationResult) GetAccount

func (ar *AuthenticationResult) GetAccount() *Account

func (*AuthenticationResult) GetDeclinedScopes

func (ar *AuthenticationResult) GetDeclinedScopes() []string

func (*AuthenticationResult) GetExpiresOn

func (ar *AuthenticationResult) GetExpiresOn() time.Time

func (*AuthenticationResult) GetGrantedScopes

func (ar *AuthenticationResult) GetGrantedScopes() []string

func (*AuthenticationResult) GetIdToken

func (ar *AuthenticationResult) GetIdToken() string

type AuthorityEndpoints

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

func CreateAuthorityEndpoints

func CreateAuthorityEndpoints(authorizationEndpoint string, tokenEndpoint string, selfSignedJwtAudience string, authorityHost string) *AuthorityEndpoints

func (*AuthorityEndpoints) GetAuthorizationEndpoint

func (endpoints *AuthorityEndpoints) GetAuthorizationEndpoint() string

func (*AuthorityEndpoints) GetTokenEndpoint

func (endpoints *AuthorityEndpoints) GetTokenEndpoint() string

func (*AuthorityEndpoints) GetUserRealmEndpoint

func (endpoints *AuthorityEndpoints) GetUserRealmEndpoint(username string) string

type AuthorityInfo

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

func CreateAuthorityInfoFromAuthorityUri

func CreateAuthorityInfoFromAuthorityUri(authorityURI string, validateAuthority bool) (*AuthorityInfo, error)

func (*AuthorityInfo) GetAuthorityType

func (i *AuthorityInfo) GetAuthorityType() AuthorityType

func (*AuthorityInfo) GetCanonicalAuthorityURI

func (i *AuthorityInfo) GetCanonicalAuthorityURI() string

func (*AuthorityInfo) GetHost

func (i *AuthorityInfo) GetHost() string

func (*AuthorityInfo) GetUserRealmURIPrefix

func (i *AuthorityInfo) GetUserRealmURIPrefix() string

func (*AuthorityInfo) GetValidateAuthority

func (i *AuthorityInfo) GetValidateAuthority() bool

func (*AuthorityInfo) Tenant

func (i *AuthorityInfo) Tenant() string

type AuthorityType

type AuthorityType int
const (
	AuthorityTypeNone AuthorityType = iota
	AuthorityTypeAad
	AuthorityTypeAdfs
	AuthorityTypeB2C
)

type AuthorizationType

type AuthorizationType int

type ClientCertificate

type ClientCertificate struct {
}

type Credential

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

func CreateCredentialAccessToken

func CreateCredentialAccessToken(
	homeAccountID string,
	environment string,
	realm string,
	clientID string,
	target string,
	cachedAt int64,
	expiresOn int64,
	extendedExpiresOn int64,
	accessToken string,
	additionalFieldsJSON string) *Credential

func CreateCredentialIdToken

func CreateCredentialIdToken(
	homeAccountID string,
	environment string,
	realm string,
	clientID string,
	cachedAt int64,
	idTokenRaw string,
	additionalFieldsJSON string) *Credential

func CreateCredentialRefreshToken

func CreateCredentialRefreshToken(
	homeAccountID string,
	environment string,
	clientID string,
	cachedAt int64,
	refreshToken string,
	additionalFieldsJSON string) *Credential

func (*Credential) GetCredentialType

func (c *Credential) GetCredentialType() CredentialType

func (*Credential) GetExpiresOn

func (c *Credential) GetExpiresOn() int64

func (*Credential) GetScopes

func (c *Credential) GetScopes() string

func (*Credential) GetSecret

func (c *Credential) GetSecret() string

type CredentialType

type CredentialType int
const (
	CredentialTypeOauth2RefreshToken CredentialType = iota
	CredentialTypeOauth2AccessToken
	CredentialTypeOidcIDToken
	CredentialTypeOther
)

type DeviceCodeResult

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

func CreateDeviceCodeResult

func CreateDeviceCodeResult(userCode string, deviceCode string, verificationURL string, expiresOn time.Time, interval int, message string, clientID string, scopes []string) *DeviceCodeResult

func (*DeviceCodeResult) GetClientID

func (dcr *DeviceCodeResult) GetClientID() string

func (*DeviceCodeResult) GetDeviceCode

func (dcr *DeviceCodeResult) GetDeviceCode() string

func (*DeviceCodeResult) GetExpiresOn

func (dcr *DeviceCodeResult) GetExpiresOn() time.Time

func (*DeviceCodeResult) GetInterval

func (dcr *DeviceCodeResult) GetInterval() int

func (*DeviceCodeResult) GetMessage

func (dcr *DeviceCodeResult) GetMessage() string

func (*DeviceCodeResult) GetScopes

func (dcr *DeviceCodeResult) GetScopes() []string

func (*DeviceCodeResult) GetUserCode

func (dcr *DeviceCodeResult) GetUserCode() string

func (*DeviceCodeResult) GetVerificationURL

func (dcr *DeviceCodeResult) GetVerificationURL() string

func (DeviceCodeResult) String

func (r DeviceCodeResult) String() string

type HTTPManager

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

HTTPManager stuff

func CreateHTTPManager

func CreateHTTPManager() *HTTPManager

CreateHTTPManager stuff

func (*HTTPManager) Get

func (mgr *HTTPManager) Get(url string, requestHeaders map[string]string) (*HTTPManagerResponse, error)

Get stuff

func (*HTTPManager) Post

func (mgr *HTTPManager) Post(url string, body string, requestHeaders map[string]string) (*HTTPManagerResponse, error)

Post stuff

type HTTPManagerResponse

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

HTTPManagerResponse stuff

func CreateHTTPManagerResponse

func CreateHTTPManagerResponse(resp *http.Response) (*HTTPManagerResponse, error)

CreateHTTPManagerResponse stuff

func (*HTTPManagerResponse) GetHeaders

func (r *HTTPManagerResponse) GetHeaders() map[string]string

GetHeaders stuff

func (*HTTPManagerResponse) GetResponseCode

func (r *HTTPManagerResponse) GetResponseCode() int

GetResponseCode stuff

func (*HTTPManagerResponse) GetResponseData

func (r *HTTPManagerResponse) GetResponseData() string

GetResponseData stuff

type ICacheManager

type ICacheManager interface {
	TryReadCache(authParameters *AuthParametersInternal) (*StorageTokenResponse, error)
	CacheTokenResponse(authParameters *AuthParametersInternal, tokenResponse *TokenResponse) (*Account, error)
	DeleteCachedRefreshToken(authParameters *AuthParametersInternal) error
}

type IDToken

type IDToken struct {
	PreferredUsername string `json:"preferred_username,omitempty"`
	GivenName         string `json:"given_name,omitempty"`
	FamilyName        string `json:"family_name,omitempty"`
	MiddleName        string `json:"middle_name,omitempty"`
	Name              string `json:"name,omitempty"`
	Oid               string `json:"oid,omitempty"`
	TenantID          string `json:"tenant_id,omitempty"`
	Subject           string `json:"subject,omitempty"`
	UPN               string `json:"upn,omitempty"`
	Email             string `json:"email,omitempty"`
	AlternativeID     string `json:"alternative_id,omitempty"`
}

func CreateIDToken

func CreateIDToken(jwt string) (*IDToken, error)

func (*IDToken) GetAlternativeId

func (t *IDToken) GetAlternativeId() string

func (*IDToken) GetFamilyName

func (t *IDToken) GetFamilyName() string

func (*IDToken) GetGivenName

func (t *IDToken) GetGivenName() string

func (*IDToken) GetMiddleName

func (t *IDToken) GetMiddleName() string

func (*IDToken) GetName

func (t *IDToken) GetName() string

func (*IDToken) GetPreferredUsername

func (t *IDToken) GetPreferredUsername() string

func (*IDToken) GetRaw

func (t *IDToken) GetRaw() string

func (*IDToken) IsEmpty

func (t *IDToken) IsEmpty() bool

type OAuthResponseBase

type OAuthResponseBase struct {
	Error            string `json:"error"`
	SubError         string `json:"suberror"`
	ErrorDescription string `json:"error_description"`
	ErrorCodes       []int  `json:"error_codes"`
	CorrelationID    string `json:"correlation_id"`
	Claims           string `json:"claims"`
}

func CreateOAuthResponseBase

func CreateOAuthResponseBase(httpStatusCode int, responseData string) (*OAuthResponseBase, error)

type StorageTokenResponse

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

func CreateStorageTokenResponse

func CreateStorageTokenResponse(accessToken *Credential, refreshToken *Credential, idToken *Credential, account *Account) *StorageTokenResponse

type TokenResponse

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

func CreateTokenResponse

func CreateTokenResponse(authParameters *AuthParametersInternal, responseCode int, responseData string) (*TokenResponse, error)

func CreateTokenResponseFromParts

func CreateTokenResponseFromParts(idToken *IDToken, accessToken *Credential, refreshToken *Credential) (*TokenResponse, error)

func (*TokenResponse) GetAccessToken

func (tr *TokenResponse) GetAccessToken() string

func (*TokenResponse) GetDeclinedScopes

func (tr *TokenResponse) GetDeclinedScopes() []string

func (*TokenResponse) GetExpiresOn

func (tr *TokenResponse) GetExpiresOn() time.Time

func (*TokenResponse) GetExtendedExpiresOn

func (tr *TokenResponse) GetExtendedExpiresOn() time.Time

func (*TokenResponse) GetGrantedScopes

func (tr *TokenResponse) GetGrantedScopes() []string

func (*TokenResponse) GetIDToken

func (tr *TokenResponse) GetIDToken() *IDToken

func (*TokenResponse) GetRawClientInfo

func (tr *TokenResponse) GetRawClientInfo() string

func (*TokenResponse) GetRefreshToken

func (tr *TokenResponse) GetRefreshToken() string

func (*TokenResponse) HasAccessToken

func (tr *TokenResponse) HasAccessToken() bool

func (*TokenResponse) HasRefreshToken

func (tr *TokenResponse) HasRefreshToken() bool

func (*TokenResponse) IsAuthorizationPending

func (tr *TokenResponse) IsAuthorizationPending() bool

type UserRealm

type UserRealm struct {
	AccountType       string `json:"account_type"`
	DomainName        string `json:"domain_name"`
	CloudInstanceNmae string `json:"cloud_instance_name"`
	CloudAudienceURN  string `json:"cloud_audience_urn"`

	// required if accountType is Federated
	FederationProtocol    string `json:"federation_protocol"`
	FederationMetadataURL string `json:"federation_metadata_url"`
}

func CreateUserRealm

func CreateUserRealm(responseData string) (*UserRealm, error)

CreateUserRealm stuff

func (*UserRealm) GetAccountType

func (u *UserRealm) GetAccountType() UserRealmAccountType

func (*UserRealm) GetCloudAudienceURN

func (u *UserRealm) GetCloudAudienceURN() string

func (*UserRealm) GetFederationMetadataURL

func (u *UserRealm) GetFederationMetadataURL() string

type UserRealmAccountType

type UserRealmAccountType int
const (
	Unknown UserRealmAccountType = iota
	Federated
	Managed
)

Jump to

Keyboard shortcuts

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