You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 16, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: internals/api/auth.go
+19-42Lines changed: 19 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,8 @@ import (
10
10
11
11
// AuthMethod options
12
12
const (
13
-
AuthMethodAWSSTS="aws-sts"
13
+
AuthMethodAWSSTS="aws-sts"
14
+
AuthMethodGCPServiceAccount="gcp-service-account"
14
15
)
15
16
16
17
// SessionType options
@@ -20,18 +21,13 @@ const (
20
21
21
22
// Errors
22
23
var (
23
-
ErrInvalidSessionType=errAPI.Code("invalid_session_type").StatusError("invalid session type provided for authentication request", http.StatusBadRequest)
24
-
ErrInvalidPayload=errAPI.Code("invalid_payload").StatusError("invalid payload provided for authentication request", http.StatusBadRequest)
ErrCouldNotGetEndpoint=errAPI.Code("aws_endpoint_not_found").StatusError("could not find an AWS endpoint for the provided region", http.StatusBadRequest)
31
-
ErrAWSException=errAPI.Code("aws_exception").StatusError("encountered an unexpected problem while verifying your identity on AWS. Please try again later.", http.StatusFailedDependency)
32
-
ErrNoServiceWithRole=errAPI.Code("no_service_with_role").StatusErrorPref("no service account found that is linked to the IAM role '%s'", http.StatusNotFound)
33
-
ErrNoAWSCredentials=errAPI.Code("missing_aws_credentials").StatusError("request was not signed with AWS credentials", http.StatusUnauthorized)
34
-
ErrInvalidAWSCredentials=errAPI.Code("invalid_aws_credentials").StatusError("credentials were not accepted by AWS", http.StatusUnauthorized)
24
+
ErrInvalidSessionType=errAPI.Code("invalid_session_type").StatusError("invalid session type provided for authentication request", http.StatusBadRequest)
25
+
ErrInvalidPayload=errAPI.Code("invalid_payload").StatusError("invalid payload provided for authentication request", http.StatusBadRequest)
ErrCouldNotGetEndpoint=errAPI.Code("aws_endpoint_not_found").StatusError("could not find an AWS endpoint for the provided region", http.StatusBadRequest)
8
+
ErrAWSException=errAPI.Code("aws_exception").StatusError("encountered an unexpected problem while verifying your identity on AWS. Please try again later.", http.StatusFailedDependency)
9
+
ErrNoServiceWithRole=errAPI.Code("no_service_with_role").StatusErrorPref("no service account found that is linked to the IAM role '%s'", http.StatusNotFound)
10
+
ErrNoAWSCredentials=errAPI.Code("missing_aws_credentials").StatusError("request was not signed with AWS credentials", http.StatusUnauthorized)
11
+
ErrInvalidAWSCredentials=errAPI.Code("invalid_aws_credentials").StatusError("credentials were not accepted by AWS", http.StatusUnauthorized)
12
+
)
13
+
14
+
// AuthPayloadAWSSTS is the authentication payload used for authenticating with AWS STS.
15
+
typeAuthPayloadAWSSTSstruct {
16
+
Regionstring`json:"region"`
17
+
Request []byte`json:"request"`
18
+
}
19
+
20
+
// NewAuthRequestAWSSTS returns a new AuthRequest for authentication using AWS STS.
ErrInvalidGCPIDToken=errAPI.Code("invalid_id_token").StatusError("provided id_token is invalid", http.StatusBadRequest)
8
+
ErrNoGCPServiceWithEmail=errAPI.Code("no_service_with_email").StatusErrorPref("no service account found that is linked to the GCP Service Account %s'", http.StatusUnauthorized)
9
+
)
10
+
11
+
// AuthPayloadGCPServiceAccount is the authentication payload used for authenticating with a GCP Service Account.
12
+
typeAuthPayloadGCPServiceAccountstruct {
13
+
IDTokenstring`json:"id_token"`
14
+
}
15
+
16
+
// NewAuthRequestGCPServiceAccount returns a new AuthRequest for authentication using a GCP Service Account.
0 commit comments