forked from kubernetes-sigs/aws-iam-authenticator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check ARN for user ID strict check (kubernetes-sigs#660)
- Loading branch information
Showing
10 changed files
with
201 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package config | ||
|
||
import ( | ||
"strings" | ||
|
||
"sigs.k8s.io/aws-iam-authenticator/pkg/token" | ||
) | ||
|
||
// IdentityMapping converts the RoleMapping into a generic IdentityMapping object | ||
func (m *RoleMapping) IdentityMapping(identity *token.Identity) *IdentityMapping { | ||
return &IdentityMapping{ | ||
IdentityARN: strings.ToLower(identity.CanonicalARN), | ||
Username: m.Username, | ||
Groups: m.Groups, | ||
} | ||
} | ||
|
||
// IdentityMapping converts the UserMapping into a generic IdentityMapping object | ||
func (m *UserMapping) IdentityMapping(identity *token.Identity) *IdentityMapping { | ||
return &IdentityMapping{ | ||
IdentityARN: strings.ToLower(identity.CanonicalARN), | ||
Username: m.Username, | ||
Groups: m.Groups, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package errutil | ||
|
||
import ( | ||
"errors" | ||
) | ||
|
||
var ErrNotMapped = errors.New("Identity is not mapped") | ||
|
||
var ErrIDAndARNMismatch = errors.New("ARN does not match User ID") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.