mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-22 12:16:52 +00:00
refactor: embed interface in large IAMService/STSService test mocks (#485)
This commit is contained in:
+12
-256
@@ -14,8 +14,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/service/iam"
|
||||
"github.com/aws/aws-sdk-go/service/sts"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/mulgadc/predastore/auth"
|
||||
"github.com/mulgadc/spinifex/spinifex/awserrors"
|
||||
@@ -35,8 +33,13 @@ const (
|
||||
testService = "ec2"
|
||||
)
|
||||
|
||||
// mockIAMService implements handlers_iam.IAMService for auth tests.
|
||||
// mockIAMService implements handlers_iam.IAMService for auth tests. It embeds
|
||||
// the interface so it satisfies the full contract; the SigV4 middleware drives
|
||||
// only LookupAccessKey and DecryptSecret, so those are the only methods wired.
|
||||
// Any other method nil-panics, surfacing an unexpected call.
|
||||
type mockIAMService struct {
|
||||
handlers_iam.IAMService
|
||||
|
||||
accessKeys map[string]*handlers_iam.AccessKey
|
||||
masterKey []byte
|
||||
}
|
||||
@@ -49,194 +52,9 @@ func (m *mockIAMService) LookupAccessKey(accessKeyID string) (*handlers_iam.Acce
|
||||
return ak, nil
|
||||
}
|
||||
|
||||
func (m *mockIAMService) CreateUser(_ string, _ *iam.CreateUserInput) (*iam.CreateUserOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) GetUser(_ string, _ *iam.GetUserInput) (*iam.GetUserOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) ListUsers(_ string, _ *iam.ListUsersInput) (*iam.ListUsersOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) DeleteUser(_ string, _ *iam.DeleteUserInput) (*iam.DeleteUserOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) CreateAccessKey(_ string, _ *iam.CreateAccessKeyInput) (*iam.CreateAccessKeyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) ListAccessKeys(_ string, _ *iam.ListAccessKeysInput) (*iam.ListAccessKeysOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) DeleteAccessKey(_ string, _ *iam.DeleteAccessKeyInput) (*iam.DeleteAccessKeyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) UpdateAccessKey(_ string, _ *iam.UpdateAccessKeyInput) (*iam.UpdateAccessKeyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) CreatePolicy(_ string, _ *iam.CreatePolicyInput) (*iam.CreatePolicyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) GetPolicy(_ string, _ *iam.GetPolicyInput) (*iam.GetPolicyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) GetPolicyVersion(_ string, _ *iam.GetPolicyVersionInput) (*iam.GetPolicyVersionOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) ListPolicyVersions(_ string, _ *iam.ListPolicyVersionsInput) (*iam.ListPolicyVersionsOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) ListPolicies(_ string, _ *iam.ListPoliciesInput) (*iam.ListPoliciesOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) DeletePolicy(_ string, _ *iam.DeletePolicyInput) (*iam.DeletePolicyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) AttachUserPolicy(_ string, _ *iam.AttachUserPolicyInput) (*iam.AttachUserPolicyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) DetachUserPolicy(_ string, _ *iam.DetachUserPolicyInput) (*iam.DetachUserPolicyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) ListAttachedUserPolicies(_ string, _ *iam.ListAttachedUserPoliciesInput) (*iam.ListAttachedUserPoliciesOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) GetUserPolicies(_, _ string) ([]handlers_iam.PolicyDocument, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) GetRolePolicies(_, _ string) ([]handlers_iam.PolicyDocument, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) DecryptSecret(ciphertext string) (string, error) {
|
||||
return handlers_iam.DecryptSecret(ciphertext, m.masterKey)
|
||||
}
|
||||
func (m *mockIAMService) SeedBootstrap(_ *handlers_iam.BootstrapData) error { return nil }
|
||||
func (m *mockIAMService) IsEmpty() (bool, error) { return true, nil }
|
||||
func (m *mockIAMService) CreateAccount(_ string) (*handlers_iam.Account, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) GetAccount(_ string) (*handlers_iam.Account, error) { return nil, nil }
|
||||
func (m *mockIAMService) ListAccounts() ([]*handlers_iam.Account, error) { return nil, nil }
|
||||
func (m *mockIAMService) GetAccountSummary(_ string, _ *iam.GetAccountSummaryInput) (*iam.GetAccountSummaryOutput, error) {
|
||||
return &iam.GetAccountSummaryOutput{}, nil
|
||||
}
|
||||
|
||||
func (m *mockIAMService) CreateRole(_ string, _ *iam.CreateRoleInput) (*iam.CreateRoleOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) GetRole(_ string, _ *iam.GetRoleInput) (*iam.GetRoleOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) ListRoles(_ string, _ *iam.ListRolesInput) (*iam.ListRolesOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) DeleteRole(_ string, _ *iam.DeleteRoleInput) (*iam.DeleteRoleOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) UpdateRole(_ string, _ *iam.UpdateRoleInput) (*iam.UpdateRoleOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) UpdateAssumeRolePolicy(_ string, _ *iam.UpdateAssumeRolePolicyInput) (*iam.UpdateAssumeRolePolicyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) AttachRolePolicy(_ string, _ *iam.AttachRolePolicyInput) (*iam.AttachRolePolicyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) DetachRolePolicy(_ string, _ *iam.DetachRolePolicyInput) (*iam.DetachRolePolicyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) ListAttachedRolePolicies(_ string, _ *iam.ListAttachedRolePoliciesInput) (*iam.ListAttachedRolePoliciesOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) PutRolePolicy(_ string, _ *iam.PutRolePolicyInput) (*iam.PutRolePolicyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) GetRolePolicy(_ string, _ *iam.GetRolePolicyInput) (*iam.GetRolePolicyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) DeleteRolePolicy(_ string, _ *iam.DeleteRolePolicyInput) (*iam.DeleteRolePolicyOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) ListRolePolicies(_ string, _ *iam.ListRolePoliciesInput) (*iam.ListRolePoliciesOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) CreateInstanceProfile(_ string, _ *iam.CreateInstanceProfileInput) (*iam.CreateInstanceProfileOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) GetInstanceProfile(_ string, _ *iam.GetInstanceProfileInput) (*iam.GetInstanceProfileOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) ListInstanceProfiles(_ string, _ *iam.ListInstanceProfilesInput) (*iam.ListInstanceProfilesOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) DeleteInstanceProfile(_ string, _ *iam.DeleteInstanceProfileInput) (*iam.DeleteInstanceProfileOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) ListInstanceProfilesForRole(_ string, _ *iam.ListInstanceProfilesForRoleInput) (*iam.ListInstanceProfilesForRoleOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) AddRoleToInstanceProfile(_ string, _ *iam.AddRoleToInstanceProfileInput) (*iam.AddRoleToInstanceProfileOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) RemoveRoleFromInstanceProfile(_ string, _ *iam.RemoveRoleFromInstanceProfileInput) (*iam.RemoveRoleFromInstanceProfileOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) ResolveInstanceProfile(_, _ string) (*handlers_iam.InstanceProfile, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) CreateGroup(_ string, _ *iam.CreateGroupInput) (*iam.CreateGroupOutput, error) {
|
||||
return &iam.CreateGroupOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) GetGroup(_ string, _ *iam.GetGroupInput) (*iam.GetGroupOutput, error) {
|
||||
return &iam.GetGroupOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) ListGroups(_ string, _ *iam.ListGroupsInput) (*iam.ListGroupsOutput, error) {
|
||||
return &iam.ListGroupsOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) DeleteGroup(_ string, _ *iam.DeleteGroupInput) (*iam.DeleteGroupOutput, error) {
|
||||
return &iam.DeleteGroupOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) AddUserToGroup(_ string, _ *iam.AddUserToGroupInput) (*iam.AddUserToGroupOutput, error) {
|
||||
return &iam.AddUserToGroupOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) RemoveUserFromGroup(_ string, _ *iam.RemoveUserFromGroupInput) (*iam.RemoveUserFromGroupOutput, error) {
|
||||
return &iam.RemoveUserFromGroupOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) ListGroupsForUser(_ string, _ *iam.ListGroupsForUserInput) (*iam.ListGroupsForUserOutput, error) {
|
||||
return &iam.ListGroupsForUserOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) AttachGroupPolicy(_ string, _ *iam.AttachGroupPolicyInput) (*iam.AttachGroupPolicyOutput, error) {
|
||||
return &iam.AttachGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) DetachGroupPolicy(_ string, _ *iam.DetachGroupPolicyInput) (*iam.DetachGroupPolicyOutput, error) {
|
||||
return &iam.DetachGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) ListAttachedGroupPolicies(_ string, _ *iam.ListAttachedGroupPoliciesInput) (*iam.ListAttachedGroupPoliciesOutput, error) {
|
||||
return &iam.ListAttachedGroupPoliciesOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) PutGroupPolicy(_ string, _ *iam.PutGroupPolicyInput) (*iam.PutGroupPolicyOutput, error) {
|
||||
return &iam.PutGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) GetGroupPolicy(_ string, _ *iam.GetGroupPolicyInput) (*iam.GetGroupPolicyOutput, error) {
|
||||
return &iam.GetGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) DeleteGroupPolicy(_ string, _ *iam.DeleteGroupPolicyInput) (*iam.DeleteGroupPolicyOutput, error) {
|
||||
return &iam.DeleteGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) ListGroupPolicies(_ string, _ *iam.ListGroupPoliciesInput) (*iam.ListGroupPoliciesOutput, error) {
|
||||
return &iam.ListGroupPoliciesOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) PutUserPolicy(_ string, _ *iam.PutUserPolicyInput) (*iam.PutUserPolicyOutput, error) {
|
||||
return &iam.PutUserPolicyOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) GetUserPolicy(_ string, _ *iam.GetUserPolicyInput) (*iam.GetUserPolicyOutput, error) {
|
||||
return &iam.GetUserPolicyOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) DeleteUserPolicy(_ string, _ *iam.DeleteUserPolicyInput) (*iam.DeleteUserPolicyOutput, error) {
|
||||
return &iam.DeleteUserPolicyOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) ListUserPolicies(_ string, _ *iam.ListUserPoliciesInput) (*iam.ListUserPoliciesOutput, error) {
|
||||
return &iam.ListUserPoliciesOutput{}, nil
|
||||
}
|
||||
|
||||
// testMasterKey is a fixed 32-byte key for deterministic tests.
|
||||
var testMasterKey []byte
|
||||
@@ -1629,27 +1447,19 @@ func TestSigV4Auth_NATSDisconnectedShortCircuit(t *testing.T) {
|
||||
// --- Session credential (ASIA) auth tests ---
|
||||
|
||||
// mockSTSService implements handlers_sts.STSService for auth-middleware tests.
|
||||
// Only LookupSessionCredential and VerifySessionToken are exercised; others
|
||||
// return nil so a misrouted call panics instead of silently allowing.
|
||||
// It embeds the interface so it satisfies the full contract; only
|
||||
// LookupSessionCredential and VerifySessionToken are exercised, and any other
|
||||
// method nil-panics so a misrouted call fails loudly instead of silently
|
||||
// allowing.
|
||||
type mockSTSService struct {
|
||||
handlers_sts.STSService
|
||||
|
||||
sessions map[string]*handlers_sts.SessionCredential
|
||||
tokens map[string]string // AKID → plaintext wire token for HMAC equivalence
|
||||
lookupErr error
|
||||
lookups atomic.Int32 // counts LookupSessionCredential calls for negative-side-effect assertions
|
||||
}
|
||||
|
||||
func (m *mockSTSService) AssumeRole(_, _, _ string, _ *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockSTSService) AssumeRoleForInstance(_, _, _ string, _ int64) (*sts.AssumeRoleOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockSTSService) GetCallerIdentity(_, _, _ string, _ *sts.GetCallerIdentityInput) (*sts.GetCallerIdentityOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockSTSService) GetSessionToken(_, _, _, _ string, _ *sts.GetSessionTokenInput) (*sts.GetSessionTokenOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockSTSService) LookupSessionCredential(accessKeyID string) (*handlers_sts.SessionCredential, error) {
|
||||
m.lookups.Add(1)
|
||||
if m.lookupErr != nil {
|
||||
@@ -1678,14 +1488,6 @@ func (m *mockSTSService) VerifySessionToken(cred *handlers_sts.SessionCredential
|
||||
return want == wireToken
|
||||
}
|
||||
|
||||
func (m *mockSTSService) AssumeRoleWithWebIdentity(_ *sts.AssumeRoleWithWebIdentityInput) (*sts.AssumeRoleWithWebIdentityOutput, error) {
|
||||
return nil, errors.New(awserrors.ErrorNotImplemented)
|
||||
}
|
||||
|
||||
func (m *mockSTSService) VerifyPresignedGetCallerIdentity(_, _ string) (*handlers_sts.PresignedCallerIdentity, error) {
|
||||
return nil, errors.New(awserrors.ErrorNotImplemented)
|
||||
}
|
||||
|
||||
const (
|
||||
testSessionAKID = "ASIATESTSESSIONAAAAA"
|
||||
testSessionToken = "wire-session-token-plain"
|
||||
@@ -2353,49 +2155,3 @@ func TestCheckPolicy_AssumedRole_PassRole_WildcardResource_Allowed(t *testing.T)
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
require.Equalf(t, http.StatusOK, resp.StatusCode, "body: %s", string(body))
|
||||
}
|
||||
|
||||
func (m *mockIAMService) TagUser(_ string, _ *iam.TagUserInput) (*iam.TagUserOutput, error) {
|
||||
return &iam.TagUserOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) UntagUser(_ string, _ *iam.UntagUserInput) (*iam.UntagUserOutput, error) {
|
||||
return &iam.UntagUserOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) ListUserTags(_ string, _ *iam.ListUserTagsInput) (*iam.ListUserTagsOutput, error) {
|
||||
return &iam.ListUserTagsOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) TagRole(_ string, _ *iam.TagRoleInput) (*iam.TagRoleOutput, error) {
|
||||
return &iam.TagRoleOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) UntagRole(_ string, _ *iam.UntagRoleInput) (*iam.UntagRoleOutput, error) {
|
||||
return &iam.UntagRoleOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) ListRoleTags(_ string, _ *iam.ListRoleTagsInput) (*iam.ListRoleTagsOutput, error) {
|
||||
return &iam.ListRoleTagsOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) TagPolicy(_ string, _ *iam.TagPolicyInput) (*iam.TagPolicyOutput, error) {
|
||||
return &iam.TagPolicyOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) UntagPolicy(_ string, _ *iam.UntagPolicyInput) (*iam.UntagPolicyOutput, error) {
|
||||
return &iam.UntagPolicyOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) ListPolicyTags(_ string, _ *iam.ListPolicyTagsInput) (*iam.ListPolicyTagsOutput, error) {
|
||||
return &iam.ListPolicyTagsOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) TagInstanceProfile(_ string, _ *iam.TagInstanceProfileInput) (*iam.TagInstanceProfileOutput, error) {
|
||||
return &iam.TagInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) UntagInstanceProfile(_ string, _ *iam.UntagInstanceProfileInput) (*iam.UntagInstanceProfileOutput, error) {
|
||||
return &iam.UntagInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) ListInstanceProfileTags(_ string, _ *iam.ListInstanceProfileTagsInput) (*iam.ListInstanceProfileTagsOutput, error) {
|
||||
return &iam.ListInstanceProfileTagsOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) TagOpenIDConnectProvider(_ string, _ *iam.TagOpenIDConnectProviderInput) (*iam.TagOpenIDConnectProviderOutput, error) {
|
||||
return &iam.TagOpenIDConnectProviderOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) UntagOpenIDConnectProvider(_ string, _ *iam.UntagOpenIDConnectProviderInput) (*iam.UntagOpenIDConnectProviderOutput, error) {
|
||||
return &iam.UntagOpenIDConnectProviderOutput{}, nil
|
||||
}
|
||||
func (m *mockIAMService) ListOpenIDConnectProviderTags(_ string, _ *iam.ListOpenIDConnectProviderTagsInput) (*iam.ListOpenIDConnectProviderTagsOutput, error) {
|
||||
return &iam.ListOpenIDConnectProviderTagsOutput{}, nil
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/aws/aws-sdk-go/service/iam"
|
||||
"github.com/mulgadc/spinifex/spinifex/awserrors"
|
||||
handlers_iam "github.com/mulgadc/spinifex/spinifex/handlers/iam"
|
||||
spxtypes "github.com/mulgadc/spinifex/spinifex/types"
|
||||
@@ -32,11 +31,13 @@ const (
|
||||
testProfileIDOther = "AIPAEXAMPLE0000000002"
|
||||
)
|
||||
|
||||
// fakeIAMService is a minimal IAMService stub for gateway-side tests. Only the
|
||||
// methods the EC2 IAM-profile gateway code actually touches are wired with
|
||||
// configurable behaviour — the rest return zero-value outputs to satisfy the
|
||||
// interface contract.
|
||||
// fakeIAMService embeds the IAMService interface so it satisfies the contract
|
||||
// without hand-writing every method. The EC2 IAM-profile gateway code only
|
||||
// touches ResolveInstanceProfile; any other method nil-panics, surfacing an
|
||||
// unexpected call rather than masking it with a zero value.
|
||||
type fakeIAMService struct {
|
||||
handlers_iam.IAMService
|
||||
|
||||
resolveFn func(accountID, nameOrARN string) (*handlers_iam.InstanceProfile, error)
|
||||
}
|
||||
|
||||
@@ -47,188 +48,6 @@ func (f *fakeIAMService) ResolveInstanceProfile(accountID, nameOrARN string) (*h
|
||||
return nil, errors.New(awserrors.ErrorIAMNoSuchEntity)
|
||||
}
|
||||
|
||||
func (f *fakeIAMService) CreateUser(string, *iam.CreateUserInput) (*iam.CreateUserOutput, error) {
|
||||
return &iam.CreateUserOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) GetUser(string, *iam.GetUserInput) (*iam.GetUserOutput, error) {
|
||||
return &iam.GetUserOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListUsers(string, *iam.ListUsersInput) (*iam.ListUsersOutput, error) {
|
||||
return &iam.ListUsersOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) DeleteUser(string, *iam.DeleteUserInput) (*iam.DeleteUserOutput, error) {
|
||||
return &iam.DeleteUserOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) CreateAccessKey(string, *iam.CreateAccessKeyInput) (*iam.CreateAccessKeyOutput, error) {
|
||||
return &iam.CreateAccessKeyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListAccessKeys(string, *iam.ListAccessKeysInput) (*iam.ListAccessKeysOutput, error) {
|
||||
return &iam.ListAccessKeysOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) DeleteAccessKey(string, *iam.DeleteAccessKeyInput) (*iam.DeleteAccessKeyOutput, error) {
|
||||
return &iam.DeleteAccessKeyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) UpdateAccessKey(string, *iam.UpdateAccessKeyInput) (*iam.UpdateAccessKeyOutput, error) {
|
||||
return &iam.UpdateAccessKeyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) CreatePolicy(string, *iam.CreatePolicyInput) (*iam.CreatePolicyOutput, error) {
|
||||
return &iam.CreatePolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) GetPolicy(string, *iam.GetPolicyInput) (*iam.GetPolicyOutput, error) {
|
||||
return &iam.GetPolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) GetPolicyVersion(string, *iam.GetPolicyVersionInput) (*iam.GetPolicyVersionOutput, error) {
|
||||
return &iam.GetPolicyVersionOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListPolicyVersions(string, *iam.ListPolicyVersionsInput) (*iam.ListPolicyVersionsOutput, error) {
|
||||
return &iam.ListPolicyVersionsOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListPolicies(string, *iam.ListPoliciesInput) (*iam.ListPoliciesOutput, error) {
|
||||
return &iam.ListPoliciesOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) DeletePolicy(string, *iam.DeletePolicyInput) (*iam.DeletePolicyOutput, error) {
|
||||
return &iam.DeletePolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) AttachUserPolicy(string, *iam.AttachUserPolicyInput) (*iam.AttachUserPolicyOutput, error) {
|
||||
return &iam.AttachUserPolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) DetachUserPolicy(string, *iam.DetachUserPolicyInput) (*iam.DetachUserPolicyOutput, error) {
|
||||
return &iam.DetachUserPolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListAttachedUserPolicies(string, *iam.ListAttachedUserPoliciesInput) (*iam.ListAttachedUserPoliciesOutput, error) {
|
||||
return &iam.ListAttachedUserPoliciesOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) CreateRole(string, *iam.CreateRoleInput) (*iam.CreateRoleOutput, error) {
|
||||
return &iam.CreateRoleOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) GetRole(string, *iam.GetRoleInput) (*iam.GetRoleOutput, error) {
|
||||
return &iam.GetRoleOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListRoles(string, *iam.ListRolesInput) (*iam.ListRolesOutput, error) {
|
||||
return &iam.ListRolesOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) DeleteRole(string, *iam.DeleteRoleInput) (*iam.DeleteRoleOutput, error) {
|
||||
return &iam.DeleteRoleOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) UpdateRole(string, *iam.UpdateRoleInput) (*iam.UpdateRoleOutput, error) {
|
||||
return &iam.UpdateRoleOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) UpdateAssumeRolePolicy(string, *iam.UpdateAssumeRolePolicyInput) (*iam.UpdateAssumeRolePolicyOutput, error) {
|
||||
return &iam.UpdateAssumeRolePolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) AttachRolePolicy(string, *iam.AttachRolePolicyInput) (*iam.AttachRolePolicyOutput, error) {
|
||||
return &iam.AttachRolePolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) DetachRolePolicy(string, *iam.DetachRolePolicyInput) (*iam.DetachRolePolicyOutput, error) {
|
||||
return &iam.DetachRolePolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListAttachedRolePolicies(string, *iam.ListAttachedRolePoliciesInput) (*iam.ListAttachedRolePoliciesOutput, error) {
|
||||
return &iam.ListAttachedRolePoliciesOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) PutRolePolicy(string, *iam.PutRolePolicyInput) (*iam.PutRolePolicyOutput, error) {
|
||||
return &iam.PutRolePolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) GetRolePolicy(string, *iam.GetRolePolicyInput) (*iam.GetRolePolicyOutput, error) {
|
||||
return &iam.GetRolePolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) DeleteRolePolicy(string, *iam.DeleteRolePolicyInput) (*iam.DeleteRolePolicyOutput, error) {
|
||||
return &iam.DeleteRolePolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListRolePolicies(string, *iam.ListRolePoliciesInput) (*iam.ListRolePoliciesOutput, error) {
|
||||
return &iam.ListRolePoliciesOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) CreateInstanceProfile(string, *iam.CreateInstanceProfileInput) (*iam.CreateInstanceProfileOutput, error) {
|
||||
return &iam.CreateInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) GetInstanceProfile(string, *iam.GetInstanceProfileInput) (*iam.GetInstanceProfileOutput, error) {
|
||||
return &iam.GetInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListInstanceProfiles(string, *iam.ListInstanceProfilesInput) (*iam.ListInstanceProfilesOutput, error) {
|
||||
return &iam.ListInstanceProfilesOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) DeleteInstanceProfile(string, *iam.DeleteInstanceProfileInput) (*iam.DeleteInstanceProfileOutput, error) {
|
||||
return &iam.DeleteInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListInstanceProfilesForRole(string, *iam.ListInstanceProfilesForRoleInput) (*iam.ListInstanceProfilesForRoleOutput, error) {
|
||||
return &iam.ListInstanceProfilesForRoleOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) AddRoleToInstanceProfile(string, *iam.AddRoleToInstanceProfileInput) (*iam.AddRoleToInstanceProfileOutput, error) {
|
||||
return &iam.AddRoleToInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) RemoveRoleFromInstanceProfile(string, *iam.RemoveRoleFromInstanceProfileInput) (*iam.RemoveRoleFromInstanceProfileOutput, error) {
|
||||
return &iam.RemoveRoleFromInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) GetUserPolicies(string, string) ([]handlers_iam.PolicyDocument, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (f *fakeIAMService) GetRolePolicies(string, string) ([]handlers_iam.PolicyDocument, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (f *fakeIAMService) LookupAccessKey(string) (*handlers_iam.AccessKey, error) { return nil, nil }
|
||||
func (f *fakeIAMService) DecryptSecret(string) (string, error) { return "", nil }
|
||||
func (f *fakeIAMService) SeedBootstrap(*handlers_iam.BootstrapData) error { return nil }
|
||||
func (f *fakeIAMService) IsEmpty() (bool, error) { return true, nil }
|
||||
func (f *fakeIAMService) CreateAccount(string) (*handlers_iam.Account, error) { return nil, nil }
|
||||
func (f *fakeIAMService) GetAccount(string) (*handlers_iam.Account, error) { return nil, nil }
|
||||
func (f *fakeIAMService) ListAccounts() ([]*handlers_iam.Account, error) { return nil, nil }
|
||||
func (f *fakeIAMService) GetAccountSummary(string, *iam.GetAccountSummaryInput) (*iam.GetAccountSummaryOutput, error) {
|
||||
return &iam.GetAccountSummaryOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) CreateGroup(string, *iam.CreateGroupInput) (*iam.CreateGroupOutput, error) {
|
||||
return &iam.CreateGroupOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) GetGroup(string, *iam.GetGroupInput) (*iam.GetGroupOutput, error) {
|
||||
return &iam.GetGroupOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListGroups(string, *iam.ListGroupsInput) (*iam.ListGroupsOutput, error) {
|
||||
return &iam.ListGroupsOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) DeleteGroup(string, *iam.DeleteGroupInput) (*iam.DeleteGroupOutput, error) {
|
||||
return &iam.DeleteGroupOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) AddUserToGroup(string, *iam.AddUserToGroupInput) (*iam.AddUserToGroupOutput, error) {
|
||||
return &iam.AddUserToGroupOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) RemoveUserFromGroup(string, *iam.RemoveUserFromGroupInput) (*iam.RemoveUserFromGroupOutput, error) {
|
||||
return &iam.RemoveUserFromGroupOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListGroupsForUser(string, *iam.ListGroupsForUserInput) (*iam.ListGroupsForUserOutput, error) {
|
||||
return &iam.ListGroupsForUserOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) AttachGroupPolicy(string, *iam.AttachGroupPolicyInput) (*iam.AttachGroupPolicyOutput, error) {
|
||||
return &iam.AttachGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) DetachGroupPolicy(string, *iam.DetachGroupPolicyInput) (*iam.DetachGroupPolicyOutput, error) {
|
||||
return &iam.DetachGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListAttachedGroupPolicies(string, *iam.ListAttachedGroupPoliciesInput) (*iam.ListAttachedGroupPoliciesOutput, error) {
|
||||
return &iam.ListAttachedGroupPoliciesOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) PutGroupPolicy(string, *iam.PutGroupPolicyInput) (*iam.PutGroupPolicyOutput, error) {
|
||||
return &iam.PutGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) GetGroupPolicy(string, *iam.GetGroupPolicyInput) (*iam.GetGroupPolicyOutput, error) {
|
||||
return &iam.GetGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) DeleteGroupPolicy(string, *iam.DeleteGroupPolicyInput) (*iam.DeleteGroupPolicyOutput, error) {
|
||||
return &iam.DeleteGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListGroupPolicies(string, *iam.ListGroupPoliciesInput) (*iam.ListGroupPoliciesOutput, error) {
|
||||
return &iam.ListGroupPoliciesOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) PutUserPolicy(string, *iam.PutUserPolicyInput) (*iam.PutUserPolicyOutput, error) {
|
||||
return &iam.PutUserPolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) GetUserPolicy(string, *iam.GetUserPolicyInput) (*iam.GetUserPolicyOutput, error) {
|
||||
return &iam.GetUserPolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) DeleteUserPolicy(string, *iam.DeleteUserPolicyInput) (*iam.DeleteUserPolicyOutput, error) {
|
||||
return &iam.DeleteUserPolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListUserPolicies(string, *iam.ListUserPoliciesInput) (*iam.ListUserPoliciesOutput, error) {
|
||||
return &iam.ListUserPoliciesOutput{}, nil
|
||||
}
|
||||
|
||||
var _ handlers_iam.IAMService = (*fakeIAMService)(nil)
|
||||
|
||||
// profileWithRole builds a resolved profile fixture pointing at the test role.
|
||||
@@ -827,49 +646,3 @@ func TestAssociationIDFormat(t *testing.T) {
|
||||
suffix := strings.TrimPrefix(id, "iip-assoc-")
|
||||
assert.NotEmpty(t, suffix, "association ID must carry a non-empty random suffix")
|
||||
}
|
||||
|
||||
func (f *fakeIAMService) TagUser(_ string, _ *iam.TagUserInput) (*iam.TagUserOutput, error) {
|
||||
return &iam.TagUserOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) UntagUser(_ string, _ *iam.UntagUserInput) (*iam.UntagUserOutput, error) {
|
||||
return &iam.UntagUserOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListUserTags(_ string, _ *iam.ListUserTagsInput) (*iam.ListUserTagsOutput, error) {
|
||||
return &iam.ListUserTagsOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) TagRole(_ string, _ *iam.TagRoleInput) (*iam.TagRoleOutput, error) {
|
||||
return &iam.TagRoleOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) UntagRole(_ string, _ *iam.UntagRoleInput) (*iam.UntagRoleOutput, error) {
|
||||
return &iam.UntagRoleOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListRoleTags(_ string, _ *iam.ListRoleTagsInput) (*iam.ListRoleTagsOutput, error) {
|
||||
return &iam.ListRoleTagsOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) TagPolicy(_ string, _ *iam.TagPolicyInput) (*iam.TagPolicyOutput, error) {
|
||||
return &iam.TagPolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) UntagPolicy(_ string, _ *iam.UntagPolicyInput) (*iam.UntagPolicyOutput, error) {
|
||||
return &iam.UntagPolicyOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListPolicyTags(_ string, _ *iam.ListPolicyTagsInput) (*iam.ListPolicyTagsOutput, error) {
|
||||
return &iam.ListPolicyTagsOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) TagInstanceProfile(_ string, _ *iam.TagInstanceProfileInput) (*iam.TagInstanceProfileOutput, error) {
|
||||
return &iam.TagInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) UntagInstanceProfile(_ string, _ *iam.UntagInstanceProfileInput) (*iam.UntagInstanceProfileOutput, error) {
|
||||
return &iam.UntagInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListInstanceProfileTags(_ string, _ *iam.ListInstanceProfileTagsInput) (*iam.ListInstanceProfileTagsOutput, error) {
|
||||
return &iam.ListInstanceProfileTagsOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) TagOpenIDConnectProvider(_ string, _ *iam.TagOpenIDConnectProviderInput) (*iam.TagOpenIDConnectProviderOutput, error) {
|
||||
return &iam.TagOpenIDConnectProviderOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) UntagOpenIDConnectProvider(_ string, _ *iam.UntagOpenIDConnectProviderInput) (*iam.UntagOpenIDConnectProviderOutput, error) {
|
||||
return &iam.UntagOpenIDConnectProviderOutput{}, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListOpenIDConnectProviderTags(_ string, _ *iam.ListOpenIDConnectProviderTagsInput) (*iam.ListOpenIDConnectProviderTagsOutput, error) {
|
||||
return &iam.ListOpenIDConnectProviderTagsOutput{}, nil
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package gateway_ec2_instance
|
||||
|
||||
import "github.com/aws/aws-sdk-go/service/iam"
|
||||
|
||||
// OIDC identity-provider registry stubs so fakeIAMService satisfies the
|
||||
// IAMService interface; EC2 instance-profile paths never call these.
|
||||
|
||||
func (f *fakeIAMService) CreateOpenIDConnectProvider(string, *iam.CreateOpenIDConnectProviderInput) (*iam.CreateOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (f *fakeIAMService) GetOpenIDConnectProvider(string, *iam.GetOpenIDConnectProviderInput) (*iam.GetOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (f *fakeIAMService) ListOpenIDConnectProviders(string, *iam.ListOpenIDConnectProvidersInput) (*iam.ListOpenIDConnectProvidersOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (f *fakeIAMService) DeleteOpenIDConnectProvider(string, *iam.DeleteOpenIDConnectProviderInput) (*iam.DeleteOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -12,9 +12,14 @@ import (
|
||||
|
||||
const testAccountID = "000000000000"
|
||||
|
||||
// stubIAMService returns empty non-nil outputs for all methods. Individual
|
||||
// tests can override a method by setting the matching function field.
|
||||
// stubIAMService embeds the IAMService interface and returns empty non-nil
|
||||
// outputs for the handler methods every happy-path test drives; those methods
|
||||
// are load-bearing and stay explicit. Methods no gateway/iam path reaches are
|
||||
// promoted from the embedded interface and nil-panic if unexpectedly called.
|
||||
// Individual tests can override a method by setting the matching function field.
|
||||
type stubIAMService struct {
|
||||
handlers_iam.IAMService
|
||||
|
||||
getInstanceProfile func(string, *iam.GetInstanceProfileInput) (*iam.GetInstanceProfileOutput, error)
|
||||
}
|
||||
|
||||
@@ -86,28 +91,6 @@ func (s *stubIAMService) ListAttachedUserPolicies(_ string, _ *iam.ListAttachedU
|
||||
return &iam.ListAttachedUserPoliciesOutput{}, nil
|
||||
}
|
||||
|
||||
func (s *stubIAMService) GetUserPolicies(_, _ string) ([]handlers_iam.PolicyDocument, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *stubIAMService) GetRolePolicies(_, _ string) ([]handlers_iam.PolicyDocument, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *stubIAMService) LookupAccessKey(_ string) (*handlers_iam.AccessKey, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *stubIAMService) DecryptSecret(_ string) (string, error) { return "", nil }
|
||||
func (s *stubIAMService) SeedBootstrap(_ *handlers_iam.BootstrapData) error { return nil }
|
||||
func (s *stubIAMService) IsEmpty() (bool, error) { return true, nil }
|
||||
|
||||
func (s *stubIAMService) CreateAccount(_ string) (*handlers_iam.Account, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (s *stubIAMService) GetAccount(_ string) (*handlers_iam.Account, error) { return nil, nil }
|
||||
func (s *stubIAMService) ListAccounts() ([]*handlers_iam.Account, error) { return nil, nil }
|
||||
|
||||
func (s *stubIAMService) CreateRole(_ string, _ *iam.CreateRoleInput) (*iam.CreateRoleOutput, error) {
|
||||
return &iam.CreateRoleOutput{}, nil
|
||||
}
|
||||
@@ -171,9 +154,6 @@ func (s *stubIAMService) AddRoleToInstanceProfile(_ string, _ *iam.AddRoleToInst
|
||||
func (s *stubIAMService) RemoveRoleFromInstanceProfile(_ string, _ *iam.RemoveRoleFromInstanceProfileInput) (*iam.RemoveRoleFromInstanceProfileOutput, error) {
|
||||
return &iam.RemoveRoleFromInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) ResolveInstanceProfile(_, _ string) (*handlers_iam.InstanceProfile, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *stubIAMService) TagUser(_ string, _ *iam.TagUserInput) (*iam.TagUserOutput, error) {
|
||||
return &iam.TagUserOutput{}, nil
|
||||
@@ -275,9 +255,6 @@ func (s *stubIAMService) DeleteUserPolicy(_ string, _ *iam.DeleteUserPolicyInput
|
||||
func (s *stubIAMService) ListUserPolicies(_ string, _ *iam.ListUserPoliciesInput) (*iam.ListUserPoliciesOutput, error) {
|
||||
return &iam.ListUserPoliciesOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) GetAccountSummary(_ string, _ *iam.GetAccountSummaryInput) (*iam.GetAccountSummaryOutput, error) {
|
||||
return &iam.GetAccountSummaryOutput{}, nil
|
||||
}
|
||||
|
||||
func TestCreateUser(t *testing.T) {
|
||||
svc := &stubIAMService{}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package gateway_iam
|
||||
|
||||
import "github.com/aws/aws-sdk-go/service/iam"
|
||||
|
||||
// OIDC identity-provider registry stubs so stubIAMService satisfies the
|
||||
// IAMService interface. Dedicated CRUD coverage lives in handlers/iam.
|
||||
|
||||
func (s *stubIAMService) CreateOpenIDConnectProvider(string, *iam.CreateOpenIDConnectProviderInput) (*iam.CreateOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (s *stubIAMService) GetOpenIDConnectProvider(string, *iam.GetOpenIDConnectProviderInput) (*iam.GetOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (s *stubIAMService) ListOpenIDConnectProviders(string, *iam.ListOpenIDConnectProvidersInput) (*iam.ListOpenIDConnectProvidersOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (s *stubIAMService) DeleteOpenIDConnectProvider(string, *iam.DeleteOpenIDConnectProviderInput) (*iam.DeleteOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -16,8 +16,13 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// flexMockIAMService is a configurable mock with per-method overrides.
|
||||
// flexMockIAMService is a configurable mock with per-method overrides. It
|
||||
// embeds the interface so it satisfies the full contract; only the fn-field
|
||||
// methods below are wired, and any other method nil-panics if a test reaches
|
||||
// an unmocked path.
|
||||
type flexMockIAMService struct {
|
||||
handlers_iam.IAMService
|
||||
|
||||
createUserFn func(string, *iam.CreateUserInput) (*iam.CreateUserOutput, error)
|
||||
getUserFn func(string, *iam.GetUserInput) (*iam.GetUserOutput, error)
|
||||
listUsersFn func(string, *iam.ListUsersInput) (*iam.ListUsersOutput, error)
|
||||
@@ -86,64 +91,6 @@ func (m *flexMockIAMService) UpdateAccessKey(accountID string, input *iam.Update
|
||||
return &iam.UpdateAccessKeyOutput{}, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) CreatePolicy(_ string, _ *iam.CreatePolicyInput) (*iam.CreatePolicyOutput, error) {
|
||||
return &iam.CreatePolicyOutput{}, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) GetPolicy(_ string, _ *iam.GetPolicyInput) (*iam.GetPolicyOutput, error) {
|
||||
return &iam.GetPolicyOutput{}, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) GetPolicyVersion(_ string, _ *iam.GetPolicyVersionInput) (*iam.GetPolicyVersionOutput, error) {
|
||||
return &iam.GetPolicyVersionOutput{}, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) ListPolicyVersions(_ string, _ *iam.ListPolicyVersionsInput) (*iam.ListPolicyVersionsOutput, error) {
|
||||
return &iam.ListPolicyVersionsOutput{}, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) ListPolicies(_ string, _ *iam.ListPoliciesInput) (*iam.ListPoliciesOutput, error) {
|
||||
return &iam.ListPoliciesOutput{}, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) DeletePolicy(_ string, _ *iam.DeletePolicyInput) (*iam.DeletePolicyOutput, error) {
|
||||
return &iam.DeletePolicyOutput{}, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) AttachUserPolicy(_ string, _ *iam.AttachUserPolicyInput) (*iam.AttachUserPolicyOutput, error) {
|
||||
return &iam.AttachUserPolicyOutput{}, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) DetachUserPolicy(_ string, _ *iam.DetachUserPolicyInput) (*iam.DetachUserPolicyOutput, error) {
|
||||
return &iam.DetachUserPolicyOutput{}, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) ListAttachedUserPolicies(_ string, _ *iam.ListAttachedUserPoliciesInput) (*iam.ListAttachedUserPoliciesOutput, error) {
|
||||
return &iam.ListAttachedUserPoliciesOutput{}, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) GetUserPolicies(_, _ string) ([]handlers_iam.PolicyDocument, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) GetRolePolicies(_, _ string) ([]handlers_iam.PolicyDocument, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) LookupAccessKey(_ string) (*handlers_iam.AccessKey, error) {
|
||||
return nil, errors.New("not implemented")
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) DecryptSecret(_ string) (string, error) { return "", nil }
|
||||
func (m *flexMockIAMService) SeedBootstrap(_ *handlers_iam.BootstrapData) error { return nil }
|
||||
func (m *flexMockIAMService) IsEmpty() (bool, error) { return true, nil }
|
||||
|
||||
func (m *flexMockIAMService) CreateAccount(_ string) (*handlers_iam.Account, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *flexMockIAMService) GetAccount(_ string) (*handlers_iam.Account, error) { return nil, nil }
|
||||
func (m *flexMockIAMService) ListAccounts() ([]*handlers_iam.Account, error) { return nil, nil }
|
||||
|
||||
func (m *flexMockIAMService) GetAccountSummary(accountID string, input *iam.GetAccountSummaryInput) (*iam.GetAccountSummaryOutput, error) {
|
||||
if m.getAccountSummaryFn != nil {
|
||||
return m.getAccountSummaryFn(accountID, input)
|
||||
@@ -151,124 +98,6 @@ func (m *flexMockIAMService) GetAccountSummary(accountID string, input *iam.GetA
|
||||
return &iam.GetAccountSummaryOutput{}, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) CreateRole(_ string, _ *iam.CreateRoleInput) (*iam.CreateRoleOutput, error) {
|
||||
return &iam.CreateRoleOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) GetRole(_ string, _ *iam.GetRoleInput) (*iam.GetRoleOutput, error) {
|
||||
return &iam.GetRoleOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListRoles(_ string, _ *iam.ListRolesInput) (*iam.ListRolesOutput, error) {
|
||||
return &iam.ListRolesOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) DeleteRole(_ string, _ *iam.DeleteRoleInput) (*iam.DeleteRoleOutput, error) {
|
||||
return &iam.DeleteRoleOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) UpdateRole(_ string, _ *iam.UpdateRoleInput) (*iam.UpdateRoleOutput, error) {
|
||||
return &iam.UpdateRoleOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) UpdateAssumeRolePolicy(_ string, _ *iam.UpdateAssumeRolePolicyInput) (*iam.UpdateAssumeRolePolicyOutput, error) {
|
||||
return &iam.UpdateAssumeRolePolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) AttachRolePolicy(_ string, _ *iam.AttachRolePolicyInput) (*iam.AttachRolePolicyOutput, error) {
|
||||
return &iam.AttachRolePolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) DetachRolePolicy(_ string, _ *iam.DetachRolePolicyInput) (*iam.DetachRolePolicyOutput, error) {
|
||||
return &iam.DetachRolePolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListAttachedRolePolicies(_ string, _ *iam.ListAttachedRolePoliciesInput) (*iam.ListAttachedRolePoliciesOutput, error) {
|
||||
return &iam.ListAttachedRolePoliciesOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) PutRolePolicy(_ string, _ *iam.PutRolePolicyInput) (*iam.PutRolePolicyOutput, error) {
|
||||
return &iam.PutRolePolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) GetRolePolicy(_ string, _ *iam.GetRolePolicyInput) (*iam.GetRolePolicyOutput, error) {
|
||||
return &iam.GetRolePolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) DeleteRolePolicy(_ string, _ *iam.DeleteRolePolicyInput) (*iam.DeleteRolePolicyOutput, error) {
|
||||
return &iam.DeleteRolePolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListRolePolicies(_ string, _ *iam.ListRolePoliciesInput) (*iam.ListRolePoliciesOutput, error) {
|
||||
return &iam.ListRolePoliciesOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) CreateInstanceProfile(_ string, _ *iam.CreateInstanceProfileInput) (*iam.CreateInstanceProfileOutput, error) {
|
||||
return &iam.CreateInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) GetInstanceProfile(_ string, _ *iam.GetInstanceProfileInput) (*iam.GetInstanceProfileOutput, error) {
|
||||
return &iam.GetInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListInstanceProfiles(_ string, _ *iam.ListInstanceProfilesInput) (*iam.ListInstanceProfilesOutput, error) {
|
||||
return &iam.ListInstanceProfilesOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) DeleteInstanceProfile(_ string, _ *iam.DeleteInstanceProfileInput) (*iam.DeleteInstanceProfileOutput, error) {
|
||||
return &iam.DeleteInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListInstanceProfilesForRole(_ string, _ *iam.ListInstanceProfilesForRoleInput) (*iam.ListInstanceProfilesForRoleOutput, error) {
|
||||
return &iam.ListInstanceProfilesForRoleOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) AddRoleToInstanceProfile(_ string, _ *iam.AddRoleToInstanceProfileInput) (*iam.AddRoleToInstanceProfileOutput, error) {
|
||||
return &iam.AddRoleToInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) RemoveRoleFromInstanceProfile(_ string, _ *iam.RemoveRoleFromInstanceProfileInput) (*iam.RemoveRoleFromInstanceProfileOutput, error) {
|
||||
return &iam.RemoveRoleFromInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ResolveInstanceProfile(_, _ string) (*handlers_iam.InstanceProfile, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *flexMockIAMService) CreateGroup(_ string, _ *iam.CreateGroupInput) (*iam.CreateGroupOutput, error) {
|
||||
return &iam.CreateGroupOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) GetGroup(_ string, _ *iam.GetGroupInput) (*iam.GetGroupOutput, error) {
|
||||
return &iam.GetGroupOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListGroups(_ string, _ *iam.ListGroupsInput) (*iam.ListGroupsOutput, error) {
|
||||
return &iam.ListGroupsOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) DeleteGroup(_ string, _ *iam.DeleteGroupInput) (*iam.DeleteGroupOutput, error) {
|
||||
return &iam.DeleteGroupOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) AddUserToGroup(_ string, _ *iam.AddUserToGroupInput) (*iam.AddUserToGroupOutput, error) {
|
||||
return &iam.AddUserToGroupOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) RemoveUserFromGroup(_ string, _ *iam.RemoveUserFromGroupInput) (*iam.RemoveUserFromGroupOutput, error) {
|
||||
return &iam.RemoveUserFromGroupOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListGroupsForUser(_ string, _ *iam.ListGroupsForUserInput) (*iam.ListGroupsForUserOutput, error) {
|
||||
return &iam.ListGroupsForUserOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) AttachGroupPolicy(_ string, _ *iam.AttachGroupPolicyInput) (*iam.AttachGroupPolicyOutput, error) {
|
||||
return &iam.AttachGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) DetachGroupPolicy(_ string, _ *iam.DetachGroupPolicyInput) (*iam.DetachGroupPolicyOutput, error) {
|
||||
return &iam.DetachGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListAttachedGroupPolicies(_ string, _ *iam.ListAttachedGroupPoliciesInput) (*iam.ListAttachedGroupPoliciesOutput, error) {
|
||||
return &iam.ListAttachedGroupPoliciesOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) PutGroupPolicy(_ string, _ *iam.PutGroupPolicyInput) (*iam.PutGroupPolicyOutput, error) {
|
||||
return &iam.PutGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) GetGroupPolicy(_ string, _ *iam.GetGroupPolicyInput) (*iam.GetGroupPolicyOutput, error) {
|
||||
return &iam.GetGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) DeleteGroupPolicy(_ string, _ *iam.DeleteGroupPolicyInput) (*iam.DeleteGroupPolicyOutput, error) {
|
||||
return &iam.DeleteGroupPolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListGroupPolicies(_ string, _ *iam.ListGroupPoliciesInput) (*iam.ListGroupPoliciesOutput, error) {
|
||||
return &iam.ListGroupPoliciesOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) PutUserPolicy(_ string, _ *iam.PutUserPolicyInput) (*iam.PutUserPolicyOutput, error) {
|
||||
return &iam.PutUserPolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) GetUserPolicy(_ string, _ *iam.GetUserPolicyInput) (*iam.GetUserPolicyOutput, error) {
|
||||
return &iam.GetUserPolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) DeleteUserPolicy(_ string, _ *iam.DeleteUserPolicyInput) (*iam.DeleteUserPolicyOutput, error) {
|
||||
return &iam.DeleteUserPolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListUserPolicies(_ string, _ *iam.ListUserPoliciesInput) (*iam.ListUserPoliciesOutput, error) {
|
||||
return &iam.ListUserPoliciesOutput{}, nil
|
||||
}
|
||||
|
||||
// setupIAMRequestHandler wires an http.Handler for IAM_Request with injected SigV4 context values.
|
||||
func setupIAMRequestHandler(svc handlers_iam.IAMService) http.Handler {
|
||||
gw := &GatewayConfig{
|
||||
@@ -475,49 +304,3 @@ func TestIAMRequest_ValidationError(t *testing.T) {
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
assert.Contains(t, string(body), "MissingParameter")
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) TagUser(_ string, _ *iam.TagUserInput) (*iam.TagUserOutput, error) {
|
||||
return &iam.TagUserOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) UntagUser(_ string, _ *iam.UntagUserInput) (*iam.UntagUserOutput, error) {
|
||||
return &iam.UntagUserOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListUserTags(_ string, _ *iam.ListUserTagsInput) (*iam.ListUserTagsOutput, error) {
|
||||
return &iam.ListUserTagsOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) TagRole(_ string, _ *iam.TagRoleInput) (*iam.TagRoleOutput, error) {
|
||||
return &iam.TagRoleOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) UntagRole(_ string, _ *iam.UntagRoleInput) (*iam.UntagRoleOutput, error) {
|
||||
return &iam.UntagRoleOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListRoleTags(_ string, _ *iam.ListRoleTagsInput) (*iam.ListRoleTagsOutput, error) {
|
||||
return &iam.ListRoleTagsOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) TagPolicy(_ string, _ *iam.TagPolicyInput) (*iam.TagPolicyOutput, error) {
|
||||
return &iam.TagPolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) UntagPolicy(_ string, _ *iam.UntagPolicyInput) (*iam.UntagPolicyOutput, error) {
|
||||
return &iam.UntagPolicyOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListPolicyTags(_ string, _ *iam.ListPolicyTagsInput) (*iam.ListPolicyTagsOutput, error) {
|
||||
return &iam.ListPolicyTagsOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) TagInstanceProfile(_ string, _ *iam.TagInstanceProfileInput) (*iam.TagInstanceProfileOutput, error) {
|
||||
return &iam.TagInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) UntagInstanceProfile(_ string, _ *iam.UntagInstanceProfileInput) (*iam.UntagInstanceProfileOutput, error) {
|
||||
return &iam.UntagInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListInstanceProfileTags(_ string, _ *iam.ListInstanceProfileTagsInput) (*iam.ListInstanceProfileTagsOutput, error) {
|
||||
return &iam.ListInstanceProfileTagsOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) TagOpenIDConnectProvider(_ string, _ *iam.TagOpenIDConnectProviderInput) (*iam.TagOpenIDConnectProviderOutput, error) {
|
||||
return &iam.TagOpenIDConnectProviderOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) UntagOpenIDConnectProvider(_ string, _ *iam.UntagOpenIDConnectProviderInput) (*iam.UntagOpenIDConnectProviderOutput, error) {
|
||||
return &iam.UntagOpenIDConnectProviderOutput{}, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListOpenIDConnectProviderTags(_ string, _ *iam.ListOpenIDConnectProviderTagsInput) (*iam.ListOpenIDConnectProviderTagsOutput, error) {
|
||||
return &iam.ListOpenIDConnectProviderTagsOutput{}, nil
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package gateway
|
||||
|
||||
import "github.com/aws/aws-sdk-go/service/iam"
|
||||
|
||||
// OIDC identity-provider registry methods — IRSA stubs so the mock IAM
|
||||
// services satisfy the IAMService interface. No gateway test exercises these
|
||||
// paths directly (covered by handlers/iam unit tests).
|
||||
|
||||
func (m *mockIAMService) CreateOpenIDConnectProvider(string, *iam.CreateOpenIDConnectProviderInput) (*iam.CreateOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) GetOpenIDConnectProvider(string, *iam.GetOpenIDConnectProviderInput) (*iam.GetOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) ListOpenIDConnectProviders(string, *iam.ListOpenIDConnectProvidersInput) (*iam.ListOpenIDConnectProvidersOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *mockIAMService) DeleteOpenIDConnectProvider(string, *iam.DeleteOpenIDConnectProviderInput) (*iam.DeleteOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (m *flexMockIAMService) CreateOpenIDConnectProvider(string, *iam.CreateOpenIDConnectProviderInput) (*iam.CreateOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *flexMockIAMService) GetOpenIDConnectProvider(string, *iam.GetOpenIDConnectProviderInput) (*iam.GetOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *flexMockIAMService) ListOpenIDConnectProviders(string, *iam.ListOpenIDConnectProvidersInput) (*iam.ListOpenIDConnectProvidersOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (m *flexMockIAMService) DeleteOpenIDConnectProvider(string, *iam.DeleteOpenIDConnectProviderInput) (*iam.DeleteOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -14,10 +14,14 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// stubSTSService implements handlers_sts.STSService for table tests. Each
|
||||
// method delegates to an injectable function so individual cases can simulate
|
||||
// the underlying service's behaviour without standing up NATS/JetStream.
|
||||
// stubSTSService implements handlers_sts.STSService for table tests. It embeds
|
||||
// the interface so it satisfies the full contract; each fn-field method
|
||||
// delegates to an injectable function so individual cases can simulate the
|
||||
// underlying service's behaviour without standing up NATS/JetStream. Any other
|
||||
// method nil-panics if a test reaches an unmocked path.
|
||||
type stubSTSService struct {
|
||||
handlers_sts.STSService
|
||||
|
||||
assumeRoleFn func(callerAccountID, callerARN, callerIdentity string, input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error)
|
||||
getCallerIdentityFn func(callerAccountID, callerARN, callerUserID string, input *sts.GetCallerIdentityInput) (*sts.GetCallerIdentityOutput, error)
|
||||
getSessionTokenFn func(callerAccountID, callerUserName, callerPrincipalType, callerAccessKeyID string, input *sts.GetSessionTokenInput) (*sts.GetSessionTokenOutput, error)
|
||||
@@ -33,13 +37,6 @@ func (s *stubSTSService) AssumeRole(callerAccountID, callerARN, callerIdentity s
|
||||
return &sts.AssumeRoleOutput{}, nil
|
||||
}
|
||||
|
||||
// AssumeRoleForInstance is the in-process IMDS entry point and is never
|
||||
// dispatched over the HTTPS gateway; the stub exists only to satisfy the
|
||||
// interface.
|
||||
func (s *stubSTSService) AssumeRoleForInstance(_, _, _ string, _ int64) (*sts.AssumeRoleOutput, error) {
|
||||
return &sts.AssumeRoleOutput{}, nil
|
||||
}
|
||||
|
||||
func (s *stubSTSService) GetCallerIdentity(callerAccountID, callerARN, callerUserID string, input *sts.GetCallerIdentityInput) (*sts.GetCallerIdentityOutput, error) {
|
||||
if s.getCallerIdentityFn != nil {
|
||||
return s.getCallerIdentityFn(callerAccountID, callerARN, callerUserID, input)
|
||||
@@ -65,23 +62,13 @@ func (s *stubSTSService) LookupSessionCredential(akid string) (*handlers_sts.Ses
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *stubSTSService) VerifySessionToken(_ *handlers_sts.SessionCredential, _ string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *stubSTSService) AssumeRoleWithWebIdentity(_ *sts.AssumeRoleWithWebIdentityInput) (*sts.AssumeRoleWithWebIdentityOutput, error) {
|
||||
return nil, errors.New(awserrors.ErrorNotImplemented)
|
||||
}
|
||||
|
||||
func (s *stubSTSService) VerifyPresignedGetCallerIdentity(_, _ string) (*handlers_sts.PresignedCallerIdentity, error) {
|
||||
return nil, errors.New(awserrors.ErrorNotImplemented)
|
||||
}
|
||||
|
||||
// stubIAMService satisfies the IAM interface to the extent needed by
|
||||
// GetCallerIdentity (only GetUser is exercised). Every other method panics so
|
||||
// a test that triggers an unexpected call fails loudly instead of silently
|
||||
// returning zero values.
|
||||
// stubIAMService embeds the IAM interface and wires only GetUser, the sole
|
||||
// method GetCallerIdentity exercises. Every other method nil-panics so a test
|
||||
// that triggers an unexpected call fails loudly instead of silently returning
|
||||
// zero values.
|
||||
type stubIAMService struct {
|
||||
handlers_iam.IAMService
|
||||
|
||||
getUserFn func(accountID string, input *iam.GetUserInput) (*iam.GetUserOutput, error)
|
||||
}
|
||||
|
||||
@@ -94,200 +81,6 @@ func (s *stubIAMService) GetUser(accountID string, input *iam.GetUserInput) (*ia
|
||||
return &iam.GetUserOutput{User: &iam.User{UserId: aws.String("AIDA00000000000000000")}}, nil
|
||||
}
|
||||
|
||||
func (s *stubIAMService) CreateUser(string, *iam.CreateUserInput) (*iam.CreateUserOutput, error) {
|
||||
panic("unexpected CreateUser call")
|
||||
}
|
||||
func (s *stubIAMService) ListUsers(string, *iam.ListUsersInput) (*iam.ListUsersOutput, error) {
|
||||
panic("unexpected ListUsers call")
|
||||
}
|
||||
func (s *stubIAMService) DeleteUser(string, *iam.DeleteUserInput) (*iam.DeleteUserOutput, error) {
|
||||
panic("unexpected DeleteUser call")
|
||||
}
|
||||
func (s *stubIAMService) CreateAccessKey(string, *iam.CreateAccessKeyInput) (*iam.CreateAccessKeyOutput, error) {
|
||||
panic("unexpected CreateAccessKey call")
|
||||
}
|
||||
func (s *stubIAMService) ListAccessKeys(string, *iam.ListAccessKeysInput) (*iam.ListAccessKeysOutput, error) {
|
||||
panic("unexpected ListAccessKeys call")
|
||||
}
|
||||
func (s *stubIAMService) DeleteAccessKey(string, *iam.DeleteAccessKeyInput) (*iam.DeleteAccessKeyOutput, error) {
|
||||
panic("unexpected DeleteAccessKey call")
|
||||
}
|
||||
func (s *stubIAMService) UpdateAccessKey(string, *iam.UpdateAccessKeyInput) (*iam.UpdateAccessKeyOutput, error) {
|
||||
panic("unexpected UpdateAccessKey call")
|
||||
}
|
||||
func (s *stubIAMService) CreatePolicy(string, *iam.CreatePolicyInput) (*iam.CreatePolicyOutput, error) {
|
||||
panic("unexpected CreatePolicy call")
|
||||
}
|
||||
func (s *stubIAMService) GetPolicy(string, *iam.GetPolicyInput) (*iam.GetPolicyOutput, error) {
|
||||
panic("unexpected GetPolicy call")
|
||||
}
|
||||
func (s *stubIAMService) GetPolicyVersion(string, *iam.GetPolicyVersionInput) (*iam.GetPolicyVersionOutput, error) {
|
||||
panic("unexpected GetPolicyVersion call")
|
||||
}
|
||||
func (s *stubIAMService) ListPolicyVersions(string, *iam.ListPolicyVersionsInput) (*iam.ListPolicyVersionsOutput, error) {
|
||||
panic("unexpected ListPolicyVersions call")
|
||||
}
|
||||
func (s *stubIAMService) ListPolicies(string, *iam.ListPoliciesInput) (*iam.ListPoliciesOutput, error) {
|
||||
panic("unexpected ListPolicies call")
|
||||
}
|
||||
func (s *stubIAMService) DeletePolicy(string, *iam.DeletePolicyInput) (*iam.DeletePolicyOutput, error) {
|
||||
panic("unexpected DeletePolicy call")
|
||||
}
|
||||
func (s *stubIAMService) AttachUserPolicy(string, *iam.AttachUserPolicyInput) (*iam.AttachUserPolicyOutput, error) {
|
||||
panic("unexpected AttachUserPolicy call")
|
||||
}
|
||||
func (s *stubIAMService) DetachUserPolicy(string, *iam.DetachUserPolicyInput) (*iam.DetachUserPolicyOutput, error) {
|
||||
panic("unexpected DetachUserPolicy call")
|
||||
}
|
||||
func (s *stubIAMService) ListAttachedUserPolicies(string, *iam.ListAttachedUserPoliciesInput) (*iam.ListAttachedUserPoliciesOutput, error) {
|
||||
panic("unexpected ListAttachedUserPolicies call")
|
||||
}
|
||||
func (s *stubIAMService) CreateRole(string, *iam.CreateRoleInput) (*iam.CreateRoleOutput, error) {
|
||||
panic("unexpected CreateRole call")
|
||||
}
|
||||
func (s *stubIAMService) GetRole(string, *iam.GetRoleInput) (*iam.GetRoleOutput, error) {
|
||||
panic("unexpected GetRole call")
|
||||
}
|
||||
func (s *stubIAMService) ListRoles(string, *iam.ListRolesInput) (*iam.ListRolesOutput, error) {
|
||||
panic("unexpected ListRoles call")
|
||||
}
|
||||
func (s *stubIAMService) DeleteRole(string, *iam.DeleteRoleInput) (*iam.DeleteRoleOutput, error) {
|
||||
panic("unexpected DeleteRole call")
|
||||
}
|
||||
func (s *stubIAMService) UpdateRole(string, *iam.UpdateRoleInput) (*iam.UpdateRoleOutput, error) {
|
||||
panic("unexpected UpdateRole call")
|
||||
}
|
||||
func (s *stubIAMService) UpdateAssumeRolePolicy(string, *iam.UpdateAssumeRolePolicyInput) (*iam.UpdateAssumeRolePolicyOutput, error) {
|
||||
panic("unexpected UpdateAssumeRolePolicy call")
|
||||
}
|
||||
func (s *stubIAMService) AttachRolePolicy(string, *iam.AttachRolePolicyInput) (*iam.AttachRolePolicyOutput, error) {
|
||||
panic("unexpected AttachRolePolicy call")
|
||||
}
|
||||
func (s *stubIAMService) DetachRolePolicy(string, *iam.DetachRolePolicyInput) (*iam.DetachRolePolicyOutput, error) {
|
||||
panic("unexpected DetachRolePolicy call")
|
||||
}
|
||||
func (s *stubIAMService) ListAttachedRolePolicies(string, *iam.ListAttachedRolePoliciesInput) (*iam.ListAttachedRolePoliciesOutput, error) {
|
||||
panic("unexpected ListAttachedRolePolicies call")
|
||||
}
|
||||
func (s *stubIAMService) PutRolePolicy(string, *iam.PutRolePolicyInput) (*iam.PutRolePolicyOutput, error) {
|
||||
panic("unexpected PutRolePolicy call")
|
||||
}
|
||||
func (s *stubIAMService) GetRolePolicy(string, *iam.GetRolePolicyInput) (*iam.GetRolePolicyOutput, error) {
|
||||
panic("unexpected GetRolePolicy call")
|
||||
}
|
||||
func (s *stubIAMService) DeleteRolePolicy(string, *iam.DeleteRolePolicyInput) (*iam.DeleteRolePolicyOutput, error) {
|
||||
panic("unexpected DeleteRolePolicy call")
|
||||
}
|
||||
func (s *stubIAMService) ListRolePolicies(string, *iam.ListRolePoliciesInput) (*iam.ListRolePoliciesOutput, error) {
|
||||
panic("unexpected ListRolePolicies call")
|
||||
}
|
||||
func (s *stubIAMService) CreateInstanceProfile(string, *iam.CreateInstanceProfileInput) (*iam.CreateInstanceProfileOutput, error) {
|
||||
panic("unexpected CreateInstanceProfile call")
|
||||
}
|
||||
func (s *stubIAMService) GetInstanceProfile(string, *iam.GetInstanceProfileInput) (*iam.GetInstanceProfileOutput, error) {
|
||||
panic("unexpected GetInstanceProfile call")
|
||||
}
|
||||
func (s *stubIAMService) ListInstanceProfiles(string, *iam.ListInstanceProfilesInput) (*iam.ListInstanceProfilesOutput, error) {
|
||||
panic("unexpected ListInstanceProfiles call")
|
||||
}
|
||||
func (s *stubIAMService) DeleteInstanceProfile(string, *iam.DeleteInstanceProfileInput) (*iam.DeleteInstanceProfileOutput, error) {
|
||||
panic("unexpected DeleteInstanceProfile call")
|
||||
}
|
||||
func (s *stubIAMService) ListInstanceProfilesForRole(string, *iam.ListInstanceProfilesForRoleInput) (*iam.ListInstanceProfilesForRoleOutput, error) {
|
||||
panic("unexpected ListInstanceProfilesForRole call")
|
||||
}
|
||||
func (s *stubIAMService) AddRoleToInstanceProfile(string, *iam.AddRoleToInstanceProfileInput) (*iam.AddRoleToInstanceProfileOutput, error) {
|
||||
panic("unexpected AddRoleToInstanceProfile call")
|
||||
}
|
||||
func (s *stubIAMService) RemoveRoleFromInstanceProfile(string, *iam.RemoveRoleFromInstanceProfileInput) (*iam.RemoveRoleFromInstanceProfileOutput, error) {
|
||||
panic("unexpected RemoveRoleFromInstanceProfile call")
|
||||
}
|
||||
func (s *stubIAMService) ResolveInstanceProfile(string, string) (*handlers_iam.InstanceProfile, error) {
|
||||
panic("unexpected ResolveInstanceProfile call")
|
||||
}
|
||||
func (s *stubIAMService) GetUserPolicies(string, string) ([]handlers_iam.PolicyDocument, error) {
|
||||
panic("unexpected GetUserPolicies call")
|
||||
}
|
||||
func (s *stubIAMService) GetRolePolicies(string, string) ([]handlers_iam.PolicyDocument, error) {
|
||||
panic("unexpected GetRolePolicies call")
|
||||
}
|
||||
func (s *stubIAMService) LookupAccessKey(string) (*handlers_iam.AccessKey, error) {
|
||||
panic("unexpected LookupAccessKey call")
|
||||
}
|
||||
func (s *stubIAMService) DecryptSecret(string) (string, error) {
|
||||
panic("unexpected DecryptSecret call")
|
||||
}
|
||||
func (s *stubIAMService) SeedBootstrap(*handlers_iam.BootstrapData) error {
|
||||
panic("unexpected SeedBootstrap call")
|
||||
}
|
||||
func (s *stubIAMService) IsEmpty() (bool, error) { panic("unexpected IsEmpty call") }
|
||||
func (s *stubIAMService) CreateAccount(string) (*handlers_iam.Account, error) {
|
||||
panic("unexpected CreateAccount call")
|
||||
}
|
||||
func (s *stubIAMService) GetAccount(string) (*handlers_iam.Account, error) {
|
||||
panic("unexpected GetAccount call")
|
||||
}
|
||||
func (s *stubIAMService) ListAccounts() ([]*handlers_iam.Account, error) {
|
||||
panic("unexpected ListAccounts call")
|
||||
}
|
||||
func (s *stubIAMService) GetAccountSummary(string, *iam.GetAccountSummaryInput) (*iam.GetAccountSummaryOutput, error) {
|
||||
panic("unexpected GetAccountSummary call")
|
||||
}
|
||||
func (s *stubIAMService) CreateGroup(string, *iam.CreateGroupInput) (*iam.CreateGroupOutput, error) {
|
||||
panic("unexpected CreateGroup call")
|
||||
}
|
||||
func (s *stubIAMService) GetGroup(string, *iam.GetGroupInput) (*iam.GetGroupOutput, error) {
|
||||
panic("unexpected GetGroup call")
|
||||
}
|
||||
func (s *stubIAMService) ListGroups(string, *iam.ListGroupsInput) (*iam.ListGroupsOutput, error) {
|
||||
panic("unexpected ListGroups call")
|
||||
}
|
||||
func (s *stubIAMService) DeleteGroup(string, *iam.DeleteGroupInput) (*iam.DeleteGroupOutput, error) {
|
||||
panic("unexpected DeleteGroup call")
|
||||
}
|
||||
func (s *stubIAMService) AddUserToGroup(string, *iam.AddUserToGroupInput) (*iam.AddUserToGroupOutput, error) {
|
||||
panic("unexpected AddUserToGroup call")
|
||||
}
|
||||
func (s *stubIAMService) RemoveUserFromGroup(string, *iam.RemoveUserFromGroupInput) (*iam.RemoveUserFromGroupOutput, error) {
|
||||
panic("unexpected RemoveUserFromGroup call")
|
||||
}
|
||||
func (s *stubIAMService) ListGroupsForUser(string, *iam.ListGroupsForUserInput) (*iam.ListGroupsForUserOutput, error) {
|
||||
panic("unexpected ListGroupsForUser call")
|
||||
}
|
||||
func (s *stubIAMService) AttachGroupPolicy(string, *iam.AttachGroupPolicyInput) (*iam.AttachGroupPolicyOutput, error) {
|
||||
panic("unexpected AttachGroupPolicy call")
|
||||
}
|
||||
func (s *stubIAMService) DetachGroupPolicy(string, *iam.DetachGroupPolicyInput) (*iam.DetachGroupPolicyOutput, error) {
|
||||
panic("unexpected DetachGroupPolicy call")
|
||||
}
|
||||
func (s *stubIAMService) ListAttachedGroupPolicies(string, *iam.ListAttachedGroupPoliciesInput) (*iam.ListAttachedGroupPoliciesOutput, error) {
|
||||
panic("unexpected ListAttachedGroupPolicies call")
|
||||
}
|
||||
func (s *stubIAMService) PutGroupPolicy(string, *iam.PutGroupPolicyInput) (*iam.PutGroupPolicyOutput, error) {
|
||||
panic("unexpected PutGroupPolicy call")
|
||||
}
|
||||
func (s *stubIAMService) GetGroupPolicy(string, *iam.GetGroupPolicyInput) (*iam.GetGroupPolicyOutput, error) {
|
||||
panic("unexpected GetGroupPolicy call")
|
||||
}
|
||||
func (s *stubIAMService) DeleteGroupPolicy(string, *iam.DeleteGroupPolicyInput) (*iam.DeleteGroupPolicyOutput, error) {
|
||||
panic("unexpected DeleteGroupPolicy call")
|
||||
}
|
||||
func (s *stubIAMService) ListGroupPolicies(string, *iam.ListGroupPoliciesInput) (*iam.ListGroupPoliciesOutput, error) {
|
||||
panic("unexpected ListGroupPolicies call")
|
||||
}
|
||||
func (s *stubIAMService) PutUserPolicy(string, *iam.PutUserPolicyInput) (*iam.PutUserPolicyOutput, error) {
|
||||
panic("unexpected PutUserPolicy call")
|
||||
}
|
||||
func (s *stubIAMService) GetUserPolicy(string, *iam.GetUserPolicyInput) (*iam.GetUserPolicyOutput, error) {
|
||||
panic("unexpected GetUserPolicy call")
|
||||
}
|
||||
func (s *stubIAMService) DeleteUserPolicy(string, *iam.DeleteUserPolicyInput) (*iam.DeleteUserPolicyOutput, error) {
|
||||
panic("unexpected DeleteUserPolicy call")
|
||||
}
|
||||
func (s *stubIAMService) ListUserPolicies(string, *iam.ListUserPoliciesInput) (*iam.ListUserPoliciesOutput, error) {
|
||||
panic("unexpected ListUserPolicies call")
|
||||
}
|
||||
|
||||
func TestAssumeRole_HappyPath(t *testing.T) {
|
||||
var calledWith struct {
|
||||
callerAccountID, callerARN, callerIdentity string
|
||||
@@ -553,49 +346,3 @@ func TestGetSessionToken_PropagatesServiceError(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
assert.Equal(t, awserrors.ErrorAccessDenied, err.Error())
|
||||
}
|
||||
|
||||
func (s *stubIAMService) TagUser(_ string, _ *iam.TagUserInput) (*iam.TagUserOutput, error) {
|
||||
return &iam.TagUserOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) UntagUser(_ string, _ *iam.UntagUserInput) (*iam.UntagUserOutput, error) {
|
||||
return &iam.UntagUserOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) ListUserTags(_ string, _ *iam.ListUserTagsInput) (*iam.ListUserTagsOutput, error) {
|
||||
return &iam.ListUserTagsOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) TagRole(_ string, _ *iam.TagRoleInput) (*iam.TagRoleOutput, error) {
|
||||
return &iam.TagRoleOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) UntagRole(_ string, _ *iam.UntagRoleInput) (*iam.UntagRoleOutput, error) {
|
||||
return &iam.UntagRoleOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) ListRoleTags(_ string, _ *iam.ListRoleTagsInput) (*iam.ListRoleTagsOutput, error) {
|
||||
return &iam.ListRoleTagsOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) TagPolicy(_ string, _ *iam.TagPolicyInput) (*iam.TagPolicyOutput, error) {
|
||||
return &iam.TagPolicyOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) UntagPolicy(_ string, _ *iam.UntagPolicyInput) (*iam.UntagPolicyOutput, error) {
|
||||
return &iam.UntagPolicyOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) ListPolicyTags(_ string, _ *iam.ListPolicyTagsInput) (*iam.ListPolicyTagsOutput, error) {
|
||||
return &iam.ListPolicyTagsOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) TagInstanceProfile(_ string, _ *iam.TagInstanceProfileInput) (*iam.TagInstanceProfileOutput, error) {
|
||||
return &iam.TagInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) UntagInstanceProfile(_ string, _ *iam.UntagInstanceProfileInput) (*iam.UntagInstanceProfileOutput, error) {
|
||||
return &iam.UntagInstanceProfileOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) ListInstanceProfileTags(_ string, _ *iam.ListInstanceProfileTagsInput) (*iam.ListInstanceProfileTagsOutput, error) {
|
||||
return &iam.ListInstanceProfileTagsOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) TagOpenIDConnectProvider(_ string, _ *iam.TagOpenIDConnectProviderInput) (*iam.TagOpenIDConnectProviderOutput, error) {
|
||||
return &iam.TagOpenIDConnectProviderOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) UntagOpenIDConnectProvider(_ string, _ *iam.UntagOpenIDConnectProviderInput) (*iam.UntagOpenIDConnectProviderOutput, error) {
|
||||
return &iam.UntagOpenIDConnectProviderOutput{}, nil
|
||||
}
|
||||
func (s *stubIAMService) ListOpenIDConnectProviderTags(_ string, _ *iam.ListOpenIDConnectProviderTagsInput) (*iam.ListOpenIDConnectProviderTagsOutput, error) {
|
||||
return &iam.ListOpenIDConnectProviderTagsOutput{}, nil
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package gateway_sts
|
||||
|
||||
import "github.com/aws/aws-sdk-go/service/iam"
|
||||
|
||||
// OIDC identity-provider registry stubs so stubIAMService satisfies the
|
||||
// IAMService interface; STS gateway tests never call these.
|
||||
|
||||
func (s *stubIAMService) CreateOpenIDConnectProvider(string, *iam.CreateOpenIDConnectProviderInput) (*iam.CreateOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (s *stubIAMService) GetOpenIDConnectProvider(string, *iam.GetOpenIDConnectProviderInput) (*iam.GetOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (s *stubIAMService) ListOpenIDConnectProviders(string, *iam.ListOpenIDConnectProvidersInput) (*iam.ListOpenIDConnectProvidersOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (s *stubIAMService) DeleteOpenIDConnectProvider(string, *iam.DeleteOpenIDConnectProviderInput) (*iam.DeleteOpenIDConnectProviderOutput, error) {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -20,8 +20,13 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// flexMockSTSService is a configurable STSService mock with per-method overrides.
|
||||
// flexMockSTSService is a configurable STSService mock with per-method
|
||||
// overrides. It embeds the interface so it satisfies the full contract; only
|
||||
// the fn-field methods below are wired, and any other method nil-panics if a
|
||||
// test reaches an unmocked path.
|
||||
type flexMockSTSService struct {
|
||||
handlers_sts.STSService
|
||||
|
||||
assumeRoleFn func(string, string, string, *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error)
|
||||
getCallerIdentityFn func(string, string, string, *sts.GetCallerIdentityInput) (*sts.GetCallerIdentityOutput, error)
|
||||
getSessionTokenFn func(string, string, string, string, *sts.GetSessionTokenInput) (*sts.GetSessionTokenOutput, error)
|
||||
@@ -38,11 +43,6 @@ func (m *flexMockSTSService) AssumeRole(callerAccountID, callerARN, callerIdenti
|
||||
return &sts.AssumeRoleOutput{}, nil
|
||||
}
|
||||
|
||||
// AssumeRoleForInstance is an in-process IMDS entry point; the mock satisfies the interface.
|
||||
func (m *flexMockSTSService) AssumeRoleForInstance(_, _, _ string, _ int64) (*sts.AssumeRoleOutput, error) {
|
||||
return &sts.AssumeRoleOutput{}, nil
|
||||
}
|
||||
|
||||
func (m *flexMockSTSService) GetCallerIdentity(callerAccountID, callerARN, callerUserID string, input *sts.GetCallerIdentityInput) (*sts.GetCallerIdentityOutput, error) {
|
||||
if m.getCallerIdentityFn != nil {
|
||||
return m.getCallerIdentityFn(callerAccountID, callerARN, callerUserID, input)
|
||||
@@ -68,10 +68,6 @@ func (m *flexMockSTSService) LookupSessionCredential(akid string) (*handlers_sts
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (m *flexMockSTSService) VerifySessionToken(*handlers_sts.SessionCredential, string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (m *flexMockSTSService) AssumeRoleWithWebIdentity(input *sts.AssumeRoleWithWebIdentityInput) (*sts.AssumeRoleWithWebIdentityOutput, error) {
|
||||
if m.assumeWebIdentityFn != nil {
|
||||
return m.assumeWebIdentityFn(input)
|
||||
@@ -79,10 +75,6 @@ func (m *flexMockSTSService) AssumeRoleWithWebIdentity(input *sts.AssumeRoleWith
|
||||
return nil, errors.New(awserrors.ErrorNotImplemented)
|
||||
}
|
||||
|
||||
func (m *flexMockSTSService) VerifyPresignedGetCallerIdentity(string, string) (*handlers_sts.PresignedCallerIdentity, error) {
|
||||
return nil, errors.New(awserrors.ErrorNotImplemented)
|
||||
}
|
||||
|
||||
// stsRequestParams holds identity values the STS dispatcher reads from SigV4 context.
|
||||
type stsRequestParams struct {
|
||||
accountID string
|
||||
|
||||
Reference in New Issue
Block a user