-
Notifications
You must be signed in to change notification settings - Fork 15
/
service_principals_test_support.go
51 lines (45 loc) · 1.31 KB
/
service_principals_test_support.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package azuretestsupport
import (
"encoding/json"
"fmt"
"github.com/hexa-org/policy-orchestrator/internal/orchestratorproviders/microsoftazure/azad"
"github.com/hexa-org/policy-orchestrator/pkg/testsupport/policytestsupport"
)
const ServicePrincipalId = "some-service-principal-id"
type AppRoleId string
const AppRoleIdGetHrUs AppRoleId = "app-role-get-hr-us"
const AppRoleIdGetProfile AppRoleId = "app-role-get-profile"
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)
func AzureServicePrincipals() azad.AzureServicePrincipals {
var sps azad.AzureServicePrincipals
_ = json.Unmarshal([]byte(ServicePrincipalsRespJson), &sps)
return sps
}