Skip to content

Commit 0625a7b

Browse files
authored
Merge branch 'master' into master
2 parents c8af102 + 2ca0d46 commit 0625a7b

9 files changed

Lines changed: 724 additions & 34 deletions

File tree

.github/workflows/go.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
matrix:
9292
os:
9393
- ubuntu-latest
94-
- ubuntu-20.04
94+
- ubuntu-22.04
9595
- macos-latest
9696
runs-on: ${{ matrix.os }}
9797
steps:
@@ -104,7 +104,7 @@ jobs:
104104
go-version-file: "go.mod"
105105

106106
- name: Install dependency required for linux builds
107-
if: matrix.os == 'ubuntu-20.04'
107+
if: matrix.os == 'ubuntu-22.04'
108108
run: sudo apt-get update && sudo apt-get install -y libudev-dev
109109

110110
- name: GoReleaser

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
matrix:
2121
os:
2222
- ubuntu-latest
23-
- ubuntu-20.04
23+
- ubuntu-22.04
2424
- macos-latest
2525
runs-on: ${{ matrix.os }}
2626
if: github.event_name != 'workflow_dispatch'
@@ -37,15 +37,15 @@ jobs:
3737
go-version-file: "go.mod"
3838

3939
- name: Install dependency required for linux builds
40-
if: matrix.os == 'ubuntu-20.04'
40+
if: matrix.os == 'ubuntu-22.04'
4141
run: sudo apt-get update && sudo apt-get install -y libudev-dev
4242

4343
- name: Add Lowercase Repository Name to Environment
4444
run: |
4545
echo REPOSITORY_NAME_LOWERCASE=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
4646
4747
- uses: "docker/login-action@v3"
48-
if: matrix.os == 'ubuntu-20.04'
48+
if: matrix.os == 'ubuntu-22.04'
4949
with:
5050
registry: "ghcr.io"
5151
username: "${{ github.actor }}"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ BIN_DIR := $(CURDIR)/bin
1616
ifeq ($(OS),Darwin)
1717
CONFIG_FILE?=$(CURDIR)/.goreleaser.macos-latest.yml
1818
else ifeq ($(OS),Linux)
19-
CONFIG_FILE?=$(CURDIR)/.goreleaser.ubuntu-20.04.yml
19+
CONFIG_FILE?=$(CURDIR)/.goreleaser.ubuntu-22.04.yml
2020
else
2121
$(error Unsupported build OS: $(OS))
2222
endif

cmd/saml2aws/commands/configure.go

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ const OneLoginOAuthPath = "/auth/oauth2/v2/token"
1919

2020
// Configure configure account profiles
2121
func Configure(configFlags *flags.CommonFlags) error {
22-
2322
idpAccountName := configFlags.IdpAccount
2423
idpAccountPassword := configFlags.Password
2524

26-
// pass in alternative location of saml2aws config file, if set.
2725
cfgm, err := cfg.NewConfigManager(configFlags.ConfigFile)
2826
if err != nil {
2927
return errors.Wrap(err, "failed to load configuration")
@@ -34,39 +32,34 @@ func Configure(configFlags *flags.CommonFlags) error {
3432
return errors.Wrap(err, "failed to load idp account")
3533
}
3634

37-
// update username and hostname if supplied
3835
flags.ApplyFlagOverrides(configFlags, account)
3936

40-
// do we need to prompt for values now?
41-
if !configFlags.SkipPrompt {
42-
err = saml2aws.PromptForConfigurationDetails(account)
43-
if err != nil {
44-
return errors.Wrap(err, "failed to input configuration")
45-
}
37+
if configFlags.SkipPrompt {
38+
return saveConfiguration(cfgm, idpAccountName, account, configFlags, idpAccountPassword)
39+
}
40+
41+
if err = saml2aws.PromptForConfigurationDetails(account); err != nil {
42+
return errors.Wrap(err, "failed to input configuration")
43+
}
4644

47-
if credentials.SupportsStorage() && idpAccountPassword == "" {
48-
password := prompter.Password("Password")
49-
if password != "" {
50-
if confirmPassword := prompter.Password("Confirm"); confirmPassword == password {
51-
idpAccountPassword = password
52-
} else {
53-
log.Println("Passwords did not match")
54-
os.Exit(1)
55-
}
56-
} else {
57-
log.Println("No password supplied")
58-
}
45+
if credentials.SupportsStorage() && idpAccountPassword == "" {
46+
idpAccountPassword = prompter.Password("Enter password")
47+
if idpAccountPassword == "" {
48+
log.Println("No password supplied")
5949
}
6050
}
6151

52+
return saveConfiguration(cfgm, idpAccountName, account, configFlags, idpAccountPassword)
53+
}
54+
55+
func saveConfiguration(cfgm *cfg.ConfigManager, idpAccountName string, account *cfg.IDPAccount, configFlags *flags.CommonFlags, idpAccountPassword string) error {
6256
if credentials.SupportsStorage() {
6357
if err := storeCredentials(configFlags, account, idpAccountPassword); err != nil {
6458
return err
6559
}
6660
}
6761

68-
err = cfgm.SaveIDPAccount(idpAccountName, account)
69-
if err != nil {
62+
if err := cfgm.SaveIDPAccount(idpAccountName, account); err != nil {
7063
return errors.Wrap(err, "failed to save configuration")
7164
}
7265

cmd/saml2aws/commands/console.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ func Console(consoleFlags *flags.ConsoleFlags) error {
4848
return errors.Wrap(err,
4949
fmt.Sprintf("error loading credentials for profile: %s", consoleFlags.LoginExecFlags.ExecProfile))
5050
}
51-
if err != nil {
52-
return errors.Wrap(err, "error logging in")
53-
}
5451

5552
if consoleFlags.LoginExecFlags.ExecProfile != "" {
5653
// Assume the desired role before generating env vars

pkg/provider/authentik/authentik.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,14 @@ func getLoginJSON(loginDetails *creds.LoginDetails, payload *authentikPayload) (
215215
switch component {
216216
case "ak-stage-identification":
217217
m["uid_field"] = loginDetails.Username
218-
if payload.HasPassowrdField {
218+
if payload.HasPasswordField {
219219
m["password"] = loginDetails.Password
220220
}
221221
case "ak-stage-password":
222222
m["password"] = loginDetails.Password
223+
224+
case "ak-stage-authenticator-validate":
225+
m["code"] = loginDetails.MFAToken
223226
default:
224227
return []byte(""), errors.New("unknown component: " + component)
225228
}
@@ -260,6 +263,9 @@ func prepareErrors(component string, errs map[string][]map[string]string) string
260263
if field == "password" {
261264
key = "password"
262265
}
266+
if field == "authenticator-validate" {
267+
key = "code"
268+
}
263269
msgs := make([]string, 0, len(errs[key]))
264270
for _, err := range errs[key] {
265271
msgs = append(msgs, fmt.Sprintf("%s %s: %s", field, err["code"], err["string"]))

0 commit comments

Comments
 (0)