Documentation ¶
Index ¶
- Constants
- Variables
- func AssignmentsForDelete(assignments []azad.AzureAppRoleAssignment) []azad.AzureAppRoleAssignment
- func AssignmentsWithoutId(assignments []azad.AzureAppRoleAssignment) []azad.AzureAppRoleAssignment
- func AzureKey() azurecommon.AzureKey
- func AzureKeyBytes() []byte
- func AzureServicePrincipals() azad.AzureServicePrincipals
- func AzureTokenCredential(httpClient azurecommon.HTTPClient) azcore.TokenCredential
- func MakeAssignments(assignments []azad.AzureAppRoleAssignment) azad.AzureAppRoleAssignments
- func MakePolicies(assignments []azad.AzureAppRoleAssignment) []hexapolicy.PolicyInfo
- func NewAppRoleAssignments(appRoleId AppRoleId, principalId string) azad.AzureAppRoleAssignment
- func SortAssignments(orig []azad.AzureAppRoleAssignment) []azad.AzureAppRoleAssignment
- type AppRoleId
- type AzureHttpClient
- func (ac *AzureHttpClient) AppRoleAssignmentsUrl() string
- func (ac *AzureHttpClient) AzureClient() azad.AzureClient
- func (ac *AzureHttpClient) DeleteAppRoleAssignmentsCalled(deleted azad.AzureAppRoleAssignment) bool
- func (ac *AzureHttpClient) DeleteAppRoleAssignmentsRequest(toDelete []azad.AzureAppRoleAssignment)
- func (ac *AzureHttpClient) ErrorRequest(method string, url string, expStatus int, body []byte)
- func (ac *AzureHttpClient) GetAppRoleAssignmentsCalled() bool
- func (ac *AzureHttpClient) GetAppRoleAssignmentsRequest(appRoleAssignments []azad.AzureAppRoleAssignment)
- func (ac *AzureHttpClient) GetPrincipalIdFromEmailRequest(principalId string)
- func (ac *AzureHttpClient) GetPrincipalIdFromEmailUrl(principalId string) string
- func (ac *AzureHttpClient) GetServicePrincipalsRequest()
- func (ac *AzureHttpClient) GetServicePrincipalsUrl() string
- func (ac *AzureHttpClient) GetUserInfoFromPrincipalIdRequest(principalId string)
- func (ac *AzureHttpClient) GetUserInfoFromPrincipalIdUrl(principalId string) string
- func (ac *AzureHttpClient) GetWebApplicationsRequest(expResp string)
- func (ac *AzureHttpClient) PostAppRoleAssignmentsCalled() bool
- func (ac *AzureHttpClient) PostAppRoleAssignmentsRequest()
- func (ac *AzureHttpClient) TokenCalled() bool
- func (ac *AzureHttpClient) TokenRequest(token string)
- func (ac *AzureHttpClient) TokenUrl() string
- type MockAzureClient
- func (m *MockAzureClient) ExpectAppRoleAssignedTo(assignments []azad.AzureAppRoleAssignment)
- func (m *MockAzureClient) ExpectGetAzureApplications()
- func (m *MockAzureClient) ExpectGetPrincipalIdFromEmail(email, principalId string)
- func (m *MockAzureClient) ExpectGetServicePrincipals()
- func (m *MockAzureClient) ExpectGetUserInfoFromPrincipalId(principalIds ...string)
- func (m *MockAzureClient) ExpectSetAppRoleAssignedTo(requestedAssignments []azad.AzureAppRoleAssignment)
- func (m *MockAzureClient) GetAppRoleAssignedTo(key []byte, servicePrincipalId string) (azad.AzureAppRoleAssignments, error)
- func (m *MockAzureClient) GetAzureApplications(key []byte) ([]azad.AzureWebApp, error)
- func (m *MockAzureClient) GetPrincipalIdFromEmail(key []byte, email string) (string, error)
- func (m *MockAzureClient) GetServicePrincipals(key []byte, appId string) (azad.AzureServicePrincipals, error)
- func (m *MockAzureClient) GetUserInfoFromPrincipalId(key []byte, principalId string) (azad.AzureUser, error)
- func (m *MockAzureClient) GetWebApplications(key []byte) ([]policyprovider.ApplicationInfo, error)
- func (m *MockAzureClient) SetAppRoleAssignedTo(key []byte, servicePrincipalId string, ...) error
Constants ¶
View Source
const AzureAppId = "anAppId"
View Source
const AzureAppName = "anAppName"
View Source
const AzureSecret = "aSecret"
View Source
const AzureSubscription = "aSubscription"
View Source
const AzureTenantId = "aTenant"
View Source
const GraphApiBaseUrl = "https://graph.microsoft.com/v1.0"
View Source
const LoginMicrosoftOnlineUrl = "https://login.microsoftonline.com"
View Source
const ServicePrincipalId = "some-service-principal-id"
Variables ¶
View Source
var AppRoleAssignmentForAdd = []azad.AzureAppRoleAssignment{ NewAppRoleAssignments(AppRoleIdGetProfile, policytestsupport.UserIdUnassigned1), NewAppRoleAssignments(AppRoleIdGetProfile, policytestsupport.UserIdUnassigned2), }
View Source
var AppRoleAssignmentGetHrUs = []azad.AzureAppRoleAssignment{ NewAppRoleAssignments(AppRoleIdGetHrUs, policytestsupport.UserIdGetHrUs), }
View Source
var AppRoleAssignmentGetHrUsAndProfile = []azad.AzureAppRoleAssignment{ NewAppRoleAssignments(AppRoleIdGetHrUs, policytestsupport.UserIdGetHrUsAndProfile), NewAppRoleAssignments(AppRoleIdGetProfile, policytestsupport.UserIdGetHrUsAndProfile), }
View Source
var AppRoleAssignmentGetProfile = []azad.AzureAppRoleAssignment{ NewAppRoleAssignments(AppRoleIdGetProfile, policytestsupport.UserIdGetProfile), }
View Source
var AppRoleAssignmentMultipleMembers = []azad.AzureAppRoleAssignment{ NewAppRoleAssignments(AppRoleIdGetHrUs, policytestsupport.UserIdGetHrUs), NewAppRoleAssignments(AppRoleIdGetHrUs, policytestsupport.UserIdGetHrUsAndProfile), }
View Source
var AppRoleAssignments = []azad.AzureAppRoleAssignment{ NewAppRoleAssignments(AppRoleIdGetHrUs, policytestsupport.UserIdGetHrUs), NewAppRoleAssignments(AppRoleIdGetProfile, policytestsupport.UserIdGetProfile), NewAppRoleAssignments(AppRoleIdGetHrUs, policytestsupport.UserIdGetHrUsAndProfile), NewAppRoleAssignments(AppRoleIdGetProfile, policytestsupport.UserIdGetHrUsAndProfile), }
View Source
var ServicePrincipalsRespJson = fmt.Sprintf(`{"value": [ { "id": "%s", "displayName": "%s", "appRoles": [ { "allowedMemberTypes": [ "User" ], "description": "Allows GET to the /humanresources/us", "displayName": "GetHR-US", "id": "%s", "isEnabled": true, "origin": "Application", "value": "%s" }, { "allowedMemberTypes": [ "User" ], "description": "Allows GET to the /profile", "displayName": "AppRoleIdGetProfile", "id": "%s", "isEnabled": true, "origin": "Application", "value": "%s" } ] }]}`, ServicePrincipalId, policytestsupport.PolicyObjectResourceId, AppRoleIdGetHrUs, policytestsupport.ActionGetHrUs, AppRoleIdGetProfile, policytestsupport.ActionGetProfile)
Functions ¶
func AssignmentsForDelete ¶
func AssignmentsForDelete(assignments []azad.AzureAppRoleAssignment) []azad.AzureAppRoleAssignment
func AssignmentsWithoutId ¶
func AssignmentsWithoutId(assignments []azad.AzureAppRoleAssignment) []azad.AzureAppRoleAssignment
func AzureKey ¶
func AzureKey() azurecommon.AzureKey
func AzureKeyBytes ¶
func AzureKeyBytes() []byte
func AzureServicePrincipals ¶
func AzureServicePrincipals() azad.AzureServicePrincipals
func AzureTokenCredential ¶
func AzureTokenCredential(httpClient azurecommon.HTTPClient) azcore.TokenCredential
func MakeAssignments ¶
func MakeAssignments(assignments []azad.AzureAppRoleAssignment) azad.AzureAppRoleAssignments
func MakePolicies ¶
func MakePolicies(assignments []azad.AzureAppRoleAssignment) []hexapolicy.PolicyInfo
func NewAppRoleAssignments ¶
func NewAppRoleAssignments(appRoleId AppRoleId, principalId string) azad.AzureAppRoleAssignment
func SortAssignments ¶
func SortAssignments(orig []azad.AzureAppRoleAssignment) []azad.AzureAppRoleAssignment
Types ¶
type AppRoleId ¶
type AppRoleId string
const AppRoleIdGetHrUs AppRoleId = "app-role-get-hr-us"
const AppRoleIdGetProfile AppRoleId = "app-role-get-profile"
type AzureHttpClient ¶
type AzureHttpClient struct { AppId string TenantId string ServicePrincipalId string MockHttpClient *testsupport.MockHTTPClient }
func NewAzureHttpClient ¶
func NewAzureHttpClient() *AzureHttpClient
func (*AzureHttpClient) AppRoleAssignmentsUrl ¶
func (ac *AzureHttpClient) AppRoleAssignmentsUrl() string
func (*AzureHttpClient) AzureClient ¶
func (ac *AzureHttpClient) AzureClient() azad.AzureClient
func (*AzureHttpClient) DeleteAppRoleAssignmentsCalled ¶
func (ac *AzureHttpClient) DeleteAppRoleAssignmentsCalled(deleted azad.AzureAppRoleAssignment) bool
func (*AzureHttpClient) DeleteAppRoleAssignmentsRequest ¶
func (ac *AzureHttpClient) DeleteAppRoleAssignmentsRequest(toDelete []azad.AzureAppRoleAssignment)
func (*AzureHttpClient) ErrorRequest ¶
func (ac *AzureHttpClient) ErrorRequest(method string, url string, expStatus int, body []byte)
func (*AzureHttpClient) GetAppRoleAssignmentsCalled ¶
func (ac *AzureHttpClient) GetAppRoleAssignmentsCalled() bool
func (*AzureHttpClient) GetAppRoleAssignmentsRequest ¶
func (ac *AzureHttpClient) GetAppRoleAssignmentsRequest(appRoleAssignments []azad.AzureAppRoleAssignment)
func (*AzureHttpClient) GetPrincipalIdFromEmailRequest ¶
func (ac *AzureHttpClient) GetPrincipalIdFromEmailRequest(principalId string)
func (*AzureHttpClient) GetPrincipalIdFromEmailUrl ¶
func (ac *AzureHttpClient) GetPrincipalIdFromEmailUrl(principalId string) string
func (*AzureHttpClient) GetServicePrincipalsRequest ¶
func (ac *AzureHttpClient) GetServicePrincipalsRequest()
func (*AzureHttpClient) GetServicePrincipalsUrl ¶
func (ac *AzureHttpClient) GetServicePrincipalsUrl() string
func (*AzureHttpClient) GetUserInfoFromPrincipalIdRequest ¶
func (ac *AzureHttpClient) GetUserInfoFromPrincipalIdRequest(principalId string)
func (*AzureHttpClient) GetUserInfoFromPrincipalIdUrl ¶
func (ac *AzureHttpClient) GetUserInfoFromPrincipalIdUrl(principalId string) string
func (*AzureHttpClient) GetWebApplicationsRequest ¶
func (ac *AzureHttpClient) GetWebApplicationsRequest(expResp string)
func (*AzureHttpClient) PostAppRoleAssignmentsCalled ¶
func (ac *AzureHttpClient) PostAppRoleAssignmentsCalled() bool
func (*AzureHttpClient) PostAppRoleAssignmentsRequest ¶
func (ac *AzureHttpClient) PostAppRoleAssignmentsRequest()
func (*AzureHttpClient) TokenCalled ¶
func (ac *AzureHttpClient) TokenCalled() bool
func (*AzureHttpClient) TokenRequest ¶
func (ac *AzureHttpClient) TokenRequest(token string)
func (*AzureHttpClient) TokenUrl ¶
func (ac *AzureHttpClient) TokenUrl() string
type MockAzureClient ¶
func NewMockAzureClient ¶
func NewMockAzureClient() *MockAzureClient
func (*MockAzureClient) ExpectAppRoleAssignedTo ¶
func (m *MockAzureClient) ExpectAppRoleAssignedTo(assignments []azad.AzureAppRoleAssignment)
func (*MockAzureClient) ExpectGetAzureApplications ¶
func (m *MockAzureClient) ExpectGetAzureApplications()
func (*MockAzureClient) ExpectGetPrincipalIdFromEmail ¶
func (m *MockAzureClient) ExpectGetPrincipalIdFromEmail(email, principalId string)
func (*MockAzureClient) ExpectGetServicePrincipals ¶
func (m *MockAzureClient) ExpectGetServicePrincipals()
func (*MockAzureClient) ExpectGetUserInfoFromPrincipalId ¶
func (m *MockAzureClient) ExpectGetUserInfoFromPrincipalId(principalIds ...string)
func (*MockAzureClient) ExpectSetAppRoleAssignedTo ¶
func (m *MockAzureClient) ExpectSetAppRoleAssignedTo(requestedAssignments []azad.AzureAppRoleAssignment)
func (*MockAzureClient) GetAppRoleAssignedTo ¶
func (m *MockAzureClient) GetAppRoleAssignedTo(key []byte, servicePrincipalId string) (azad.AzureAppRoleAssignments, error)
func (*MockAzureClient) GetAzureApplications ¶
func (m *MockAzureClient) GetAzureApplications(key []byte) ([]azad.AzureWebApp, error)
func (*MockAzureClient) GetPrincipalIdFromEmail ¶
func (m *MockAzureClient) GetPrincipalIdFromEmail(key []byte, email string) (string, error)
func (*MockAzureClient) GetServicePrincipals ¶
func (m *MockAzureClient) GetServicePrincipals(key []byte, appId string) (azad.AzureServicePrincipals, error)
func (*MockAzureClient) GetUserInfoFromPrincipalId ¶
func (*MockAzureClient) GetWebApplications ¶
func (m *MockAzureClient) GetWebApplications(key []byte) ([]policyprovider.ApplicationInfo, error)
func (*MockAzureClient) SetAppRoleAssignedTo ¶
func (m *MockAzureClient) SetAppRoleAssignedTo(key []byte, servicePrincipalId string, assignments []azad.AzureAppRoleAssignment) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.