1234567891011121314151617181920212223242526272829303132333435 |
- package service
- import (
- "fmt"
- "aws-sts-mock/pkg/sigv4"
- "aws-sts-mock/pkg/sts"
- )
- // STSService handles STS business logic
- type STSService struct {
- // Add dependencies if needed (e.g., user store, role manager)
- }
- // NewSTSService creates a new STS service
- func NewSTSService() *STSService {
- return &STSService{}
- }
- // GetCallerIdentity returns the caller's identity information
- func (s *STSService) GetCallerIdentity(creds sigv4.AWSCredentials) (*sts.GetCallerIdentityResult, error) {
- return &sts.GetCallerIdentityResult{
- UserId: creds.AccountID,
- Account: creds.AccountID,
- Arn: fmt.Sprintf("arn:aws:iam::%s:root", creds.AccountID),
- }, nil
- }
- // ValidateAPIVersion checks if the API version is supported
- func (s *STSService) ValidateAPIVersion(version string) error {
- if version != "2011-06-15" {
- return fmt.Errorf("invalid API version: %s", version)
- }
- return nil
- }
|