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
fix: clear-cache pass username as per requirements of lib (#18)
* fix: clear-cache pass username as per requirements of lib
+semver: feat
add clean up to launcher and browser
* fix: put back delete file for cache clear
* fix: add consts
* fix: bump version
* fix: add global safe directory
* fix: add compile time consts in helpers
fix: ~~user supplied duration will be applied to the last role in the chain~~ API sessions only allow a maximum of an hour
fix: add validations to flags
* fix: add tests to command
add additional notes to flags
remove millisecond precision in timeout
Short: "Clears any stored credentials in the OS secret store",
17
18
RunE: clear,
@@ -20,29 +21,41 @@ var (
20
21
21
22
funcinit() {
22
23
cobra.OnInitialize(samlInitConfig)
23
-
clearCmd.PersistentFlags().BoolVarP(&force, "force", "f", false, "If aws-cli-auth exited improprely in a previous run there is a chance that there could be hanging processes left over - this will clean them up forcefully")
24
-
rootCmd.AddCommand(clearCmd)
24
+
ClearCmd.PersistentFlags().BoolVarP(&force, "force", "f", false, `If aws-cli-auth exited improprely in a previous run there is a chance that there could be hanging processes left over.
25
+
26
+
This will forcefully all chromium processes.
27
+
28
+
If you are on a windows machine and also use chrome as your current/main browser this will also kill those processes.
Copy file name to clipboardExpand all lines: cmd/root.go
+12-7Lines changed: 12 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,8 @@ var (
20
20
rolestring
21
21
roleChain []string
22
22
verbosebool
23
-
rootCmd=&cobra.Command{
23
+
durationint
24
+
RootCmd=&cobra.Command{
24
25
Use: "aws-cli-auth",
25
26
Short: "CLI tool for retrieving AWS temporary credentials",
26
27
Long: `CLI tool for retrieving AWS temporary credentials using SAML providers, or specified method of retrieval - i.e. force AWS_WEB_IDENTITY.
@@ -31,17 +32,21 @@ Stores them under the $HOME/.aws/credentials file under a specified path or retu
31
32
)
32
33
33
34
funcExecute(ctx context.Context) {
34
-
iferr:=rootCmd.ExecuteContext(ctx); err!=nil {
35
+
iferr:=RootCmd.ExecuteContext(ctx); err!=nil {
35
36
fmt.Errorf("cli error: %v", err)
36
37
os.Exit(1)
37
38
}
38
39
os.Exit(0)
39
40
}
40
41
41
42
funcinit() {
42
-
rootCmd.PersistentFlags().StringVarP(&role, "role", "r", "", "Set the role you want to assume when SAML or OIDC process completes")
43
-
rootCmd.PersistentFlags().StringSliceVarP(&roleChain, "role-chain", "", []string{}, "If specified it will assume the roles from the base credentials, in order they are specified in")
44
-
rootCmd.PersistentFlags().StringVarP(&cfgSectionName, "cfg-section", "", "", "config section name in the yaml config file")
45
-
rootCmd.PersistentFlags().BoolVarP(&storeInProfile, "store-profile", "s", false, "By default the credentials are returned to stdout to be used by the credential_process. Set this flag to instead store the credentials under a named profile section")
RootCmd.PersistentFlags().StringSliceVarP(&roleChain, "role-chain", "", []string{}, "If specified it will assume the roles from the base credentials, in order they are specified in")
44
+
RootCmd.PersistentFlags().BoolVarP(&storeInProfile, "store-profile", "s", false, `By default the credentials are returned to stdout to be used by the credential_process.
45
+
Set this flag to instead store the credentials under a named profile section. You can then reference that profile name via the CLI or for use in an SDK`)
46
+
RootCmd.PersistentFlags().StringVarP(&cfgSectionName, "cfg-section", "", "", "Config section name in the default AWS credentials file. To enable priofi")
47
+
// When specifying store in profile the config section name must be provided
RootCmd.PersistentFlags().IntVarP(&duration, "max-duration", "d", 900, `Override default max session duration, in seconds, of the role session [900-43200].
50
+
NB: This cannot be higher than the 3600 as the API does not allow for AssumeRole for sessions longer than an hour`)
samlCmd.PersistentFlags().StringVarP(&principalArn, "principal", "", "", "Principal Arn of the SAML IdP in AWS")
54
-
samlCmd.PersistentFlags().StringVarP(&acsUrl, "acsurl", "a", "https://signin.aws.amazon.com/saml", "Override the default ACS Url, used for checkin the post of the SAMLResponse")
55
-
samlCmd.PersistentFlags().StringVarP(&ssoUserEndpoint, "sso-user-endpoint", "", "https://portal.sso.%s.amazonaws.com/user", "UserEndpoint in a go style fmt.Sprintf string with a region placeholder")
56
-
samlCmd.PersistentFlags().StringVarP(&ssoRole, "sso-role", "", "", "Sso Role name must be in this format - 12345678910:PowerUser")
57
-
samlCmd.PersistentFlags().StringVarP(&ssoFedCredEndpoint, "sso-fed-endpoint", "", "https://portal.sso.%s.amazonaws.com/federation/credentials/", "FederationCredEndpoint in a go style fmt.Sprintf string with a region placeholder")
58
-
samlCmd.PersistentFlags().StringVarP(&ssoRegion, "sso-region", "", "eu-west-1", "If using SSO, you must set the region")
59
-
samlCmd.PersistentFlags().IntVarP(&duration, "max-duration", "d", 900, "Override default max session duration, in seconds, of the role session [900-43200]")
60
-
samlCmd.PersistentFlags().BoolVarP(&isSso, "is-sso", "", false, `Enables the new AWS User portal login.
SamlCmd.PersistentFlags().StringVarP(&role, "role", "r", "", `Set the role you want to assume when SAML or OIDC process completes`)
77
+
SamlCmd.PersistentFlags().StringVarP(&acsUrl, "acsurl", "a", "https://signin.aws.amazon.com/saml", "Override the default ACS Url, used for checkin the post of the SAMLResponse")
78
+
SamlCmd.PersistentFlags().StringVarP(&ssoUserEndpoint, "sso-user-endpoint", "", UserEndpoint, "UserEndpoint in a go style fmt.Sprintf string with a region placeholder")
79
+
SamlCmd.PersistentFlags().StringVarP(&ssoRole, "sso-role", "", "", "Sso Role name must be in this format - 12345678910:PowerUser")
80
+
SamlCmd.PersistentFlags().StringVarP(&ssoFedCredEndpoint, "sso-fed-endpoint", "", CredsEndpoint, "FederationCredEndpoint in a go style fmt.Sprintf string with a region placeholder")
81
+
SamlCmd.PersistentFlags().StringVarP(&ssoRegion, "sso-region", "", "eu-west-1", "If using SSO, you must set the region")
82
+
SamlCmd.PersistentFlags().BoolVarP(&isSso, "is-sso", "", false, `Enables the new AWS User portal login.
61
83
If this flag is specified the --sso-role must also be specified.`)
62
-
samlCmd.PersistentFlags().IntVarP(&reloadBeforeTime, "reload-before", "", 0, "Triggers a credentials refresh before the specified max-duration. Value provided in seconds. Should be less than the max-duration of the session")
63
-
rootCmd.AddCommand(samlCmd)
84
+
SamlCmd.PersistentFlags().IntVarP(&reloadBeforeTime, "reload-before", "", 0, "Triggers a credentials refresh before the specified max-duration. Value provided in seconds. Should be less than the max-duration of the session")
SamlCmd.PersistentFlags().Int32VarP(&samlTimeout, "saml-timeout", "", 120, "Timeout in seconds, before the operation of waiting for a response is cancelled via the chrome driver")
0 commit comments