Skip to content

Commit 7adf2e0

Browse files
authored
Merge branch 'master' into dependabot/go_modules/github.com/go-jose/go-jose/v3-3.0.4
2 parents 01a3cc2 + c62710a commit 7adf2e0

File tree

12 files changed

+282
-49
lines changed

12 files changed

+282
-49
lines changed

.github/workflows/go.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676

7777
- uses: actions/download-artifact@v4
7878
with:
79-
name: macos-12_reports
79+
name: macos-13_reports
8080
path: reports
8181

8282
- name: Codecov

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ARCH=$(shell uname -m)
33
OS?=$(shell uname)
44
ITERATION := 1
55

6-
GOLANGCI_VERSION = 1.53.2
6+
GOLANGCI_VERSION = 1.55.2
77
GORELEASER := $(shell command -v goreleaser 2> /dev/null)
88

99
SOURCE_FILES?=$$(go list ./... | grep -v /vendor/)
@@ -42,7 +42,7 @@ fmt: lint-fix
4242

4343
install:
4444
go install ./cmd/saml2aws
45-
.PHONY: mod
45+
.PHONY: install
4646

4747
build:
4848

@@ -80,4 +80,4 @@ test:
8080
docker-build-environment:
8181
docker build --platform=amd64 -t saml2aws/build -f Dockerfile.build .
8282
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock -e BUILDX_CONFIG=$(PWD)/.buildtemp -e GOPATH=$(PWD)/.buildtemp -e GOTMPDIR=$(PWD)/.buildtemp -e GOCACHE=$(PWD)/.buildtemp/.cache -e GOENV=$(PWD)/.buildtemp/env -v $(PWD):$(PWD) -w $(PWD) saml2aws/build:latest
83-
.PHONY: docker-build-environment
83+
.PHONY: docker-build-environment

cmd/saml2aws/commands/login.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525

2626
// Login login to ADFS
2727
func Login(loginFlags *flags.LoginExecFlags) error {
28-
2928
logger := logrus.WithField("command", "login")
3029

3130
account, err := buildIdpAccount(loginFlags)
@@ -258,6 +257,11 @@ func resolveLoginDetails(account *cfg.IDPAccount, loginFlags *flags.LoginExecFla
258257
loginDetails.DownloadBrowser = account.DownloadBrowser
259258
}
260259

260+
// parse KCBroker if set
261+
if account.KCBroker != "" {
262+
loginDetails.KCBroker = account.KCBroker
263+
}
264+
261265
// log.Printf("loginDetails %+v", loginDetails)
262266

263267
// if skip prompt was passed just pass back the flag values

cmd/saml2aws/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ func main() {
9191
app.Flag("disable-keychain", "Do not use keychain at all. This will also disable Okta sessions & remembering MFA device. (env: SAML2AWS_DISABLE_KEYCHAIN)").Envar("SAML2AWS_DISABLE_KEYCHAIN").BoolVar(&commonFlags.DisableKeychain)
9292
app.Flag("region", "AWS region to use for API requests, e.g. us-east-1, us-gov-west-1, cn-north-1 (env: SAML2AWS_REGION)").Envar("SAML2AWS_REGION").Short('r').StringVar(&commonFlags.Region)
9393
app.Flag("prompter", "The prompter to use for user input (default, pinentry)").StringVar(&commonFlags.Prompter)
94+
app.Flag("kc-broker", "The kc broker to use when authenticating via keycloak").StringVar(&commonFlags.KCBroker)
9495

9596
// `configure` command and settings
9697
cmdConfigure := app.Command("configure", "Configure a new IDP account.")
@@ -190,7 +191,6 @@ func main() {
190191
http.DefaultTransport.(*http.Transport).Proxy = http.ProxyFromEnvironment
191192

192193
logrus.WithField("command", command).Debug("Running")
193-
194194
var err error
195195
switch command {
196196
case cmdScript.FullCommand():

go.mod

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ require (
5555
github.com/tidwall/match v1.1.1 // indirect
5656
github.com/tidwall/pretty v1.2.1 // indirect
5757
go.uber.org/multierr v1.11.0 // indirect
58-
golang.org/x/crypto v0.28.0 // indirect
58+
golang.org/x/crypto v0.31.0 // indirect
5959
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
60-
golang.org/x/sys v0.26.0 // indirect
61-
golang.org/x/term v0.25.0 // indirect
62-
golang.org/x/text v0.19.0 // indirect
60+
golang.org/x/sys v0.28.0 // indirect
61+
golang.org/x/term v0.27.0 // indirect
62+
golang.org/x/text v0.21.0 // indirect
6363
gopkg.in/yaml.v3 v3.0.1 // indirect
6464
)

go.sum

+8-8
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf
203203
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
204204
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
205205
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
206-
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
207-
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
206+
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
207+
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
208208
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM=
209209
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
210210
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -247,25 +247,25 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
247247
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
248248
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
249249
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
250-
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
251-
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
250+
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
251+
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
252252
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
253253
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
254254
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
255255
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
256256
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
257257
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
258-
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
259-
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
258+
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
259+
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
260260
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
261261
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
262262
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
263263
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
264264
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
265265
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
266266
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
267-
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
268-
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
267+
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
268+
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
269269
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
270270
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
271271
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

pkg/cfg/cfg.go

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ type IDPAccount struct {
6969
Prompter string `ini:"prompter"`
7070
KCAuthErrorMessage string `ini:"kc_auth_error_message,omitempty"` // used by KeyCloak; hide from user if not set
7171
KCAuthErrorElement string `ini:"kc_auth_error_element,omitempty"` // used by KeyCloak; hide from user if not set
72+
KCBroker string `ini:"kc_broker"` // used by KeyCloak;
7273
}
7374

7475
func (ia IDPAccount) String() string {

pkg/creds/creds.go

+1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ type LoginDetails struct {
1313
URL string
1414
StateToken string // used by Okta
1515
OktaSessionCookie string // used by Okta
16+
KCBroker string // used by KeyCloak
1617
}

pkg/flags/flags.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ type CommonFlags struct {
3939
DisableRememberDevice bool
4040
DisableSessions bool
4141
Prompter string
42+
KCBroker string
4243
}
4344

4445
// LoginExecFlags flags for the Login / Exec commands
@@ -147,7 +148,9 @@ func ApplyFlagOverrides(commonFlags *CommonFlags, account *cfg.IDPAccount) {
147148
if commonFlags.Prompter != "" {
148149
account.Prompter = commonFlags.Prompter
149150
}
150-
151+
if commonFlags.KCBroker != "" {
152+
account.KCBroker = commonFlags.KCBroker
153+
}
151154
// select the prompter
152155
if commonFlags.Prompter != "" {
153156
account.Prompter = commonFlags.Prompter
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
<!DOCTYPE html>
2+
<html class="login-pf" lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
7+
<meta name="robots" content="noindex, nofollow">
8+
<meta name="color-scheme" content="light dark">
9+
<meta name="viewport" content="width=device-width, initial-scale=1">
10+
11+
<title>Sign in to internal</title>
12+
<link rel="icon" href="/resources/kb6gy/login/keycloak.v2/img/favicon.ico" />
13+
<link href="/resources/kb6gy/common/keycloak/vendor/patternfly-v5/patternfly.min.css" rel="stylesheet" />
14+
<link href="/resources/kb6gy/common/keycloak/vendor/patternfly-v5/patternfly-addons.css" rel="stylesheet" />
15+
<link href="/resources/kb6gy/login/keycloak.v2/css/styles.css" rel="stylesheet" />
16+
<script type="importmap">
17+
{
18+
"imports": {
19+
"rfc4648": "/resources/kb6gy/common/keycloak/vendor/rfc4648/rfc4648.js"
20+
}
21+
}
22+
</script>
23+
<script type="module" async blocking="render">
24+
const DARK_MODE_CLASS = "pf-v5-theme-dark";
25+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
26+
27+
updateDarkMode(mediaQuery.matches);
28+
mediaQuery.addEventListener("change", (event) => updateDarkMode(event.matches));
29+
30+
function updateDarkMode(isEnabled) {
31+
const { classList } = document.documentElement;
32+
33+
if (isEnabled) {
34+
classList.add(DARK_MODE_CLASS);
35+
} else {
36+
classList.remove(DARK_MODE_CLASS);
37+
}
38+
}
39+
</script>
40+
<script type="module" src="/resources/kb6gy/login/keycloak.v2/js/passwordVisibility.js"></script>
41+
<script type="module">
42+
import { startSessionPolling } from "/resources/kb6gy/login/keycloak.v2/js/authChecker.js";
43+
44+
startSessionPolling(
45+
"/realms/internal/login-actions/restart?client_id=urn%3Aamazon%3Awebservices&tab_id=tabId&client_data=clientData&skip_logout=true"
46+
);
47+
</script>
48+
<script type="module">
49+
import { checkAuthSession } from "/resources/kb6gy/login/keycloak.v2/js/authChecker.js";
50+
51+
checkAuthSession(
52+
"sessionId"
53+
);
54+
</script>
55+
<script>
56+
// Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1404468
57+
const isFirefox = true;
58+
</script>
59+
<SCRIPT> if (typeof history.replaceState === 'function') { history.replaceState({}, "some title", "https://my.domain/realms/internal/login-actions/authenticate?execution=uuid&client_id=urn%3Aamazon%3Awebservices&tab_id=tabId&client_data=clientData"); }</SCRIPT></head>
60+
61+
<body id="keycloak-bg" class="">
62+
<div class="pf-v5-c-login">
63+
<div class="pf-v5-c-login__container">
64+
<header id="kc-header" class="pf-v5-c-login__header">
65+
<div id="kc-header-wrapper"
66+
class="pf-v5-c-brand">internal</div>
67+
</header>
68+
<main class="pf-v5-c-login__main">
69+
<div class="pf-v5-c-login__main-header">
70+
<h1 class="pf-v5-c-title pf-m-3xl" id="kc-page-title"><!-- template: login.ftl -->
71+
72+
Sign in to your account
73+
74+
</h1>
75+
</div>
76+
<div class="pf-v5-c-login__main-body">
77+
78+
79+
<!-- template: login.ftl -->
80+
81+
<div id="kc-form">
82+
<div id="kc-form-wrapper">
83+
<form id="kc-form-login" class="pf-v5-c-form" onsubmit="login.disabled = true; return true;" action="https://my.domain/realms/internal/login-actions/authenticate?session_code=sessionId&amp;execution=uuid&amp;client_id=urn%3Aamazon%3Awebservices&amp;tab_id=tabId&amp;client_data=clientData" method="post" novalidate="novalidate">
84+
85+
<div class="pf-v5-c-form__group">
86+
<div class="pf-v5-c-form__label">
87+
<label for="username" class="pf-v5-c-form__label">
88+
<span class="pf-v5-c-form__label-text">
89+
Username or email
90+
91+
</span>
92+
</label>
93+
</div>
94+
95+
<span class="pf-v5-c-form-control pf-m-error">
96+
<input id="username" name="username" value="aorlovskiy" type="text" autocomplete="username" autofocus
97+
aria-invalid="true"/>
98+
<span class="pf-v5-c-form-control__utilities">
99+
<span class="pf-v5-c-form-control__icon pf-m-status">
100+
<i class="fas fa-exclamation-circle" aria-hidden="true"></i>
101+
</span>
102+
</span>
103+
</span>
104+
105+
<div id="input-error-container-username">
106+
<div class="pf-v5-c-form__helper-text" aria-live="polite">
107+
<div class="pf-v5-c-helper-text">
108+
<div class="pf-v5-c-helper-text__item pf-m-error" id="input-error-username">
109+
<span class="pf-v5-c-helper-text__item-text pf-m-error kc-feedback-text">
110+
Invalid username or password.
111+
</span>
112+
</div>
113+
</div>
114+
</div>
115+
</div>
116+
</div>
117+
118+
119+
<div class="pf-v5-c-form__group">
120+
<div class="pf-v5-c-form__label">
121+
<label for="password" class="pf-v5-c-form__label">
122+
<span class="pf-v5-c-form__label-text">
123+
Password
124+
</span>
125+
</label>
126+
</div>
127+
128+
<div class="pf-v5-c-input-group">
129+
<div class="pf-v5-c-input-group__item pf-m-fill">
130+
<span class="pf-v5-c-form-control ">
131+
<input id="password" name="password" value="" type="password" autocomplete="current-password"
132+
aria-invalid=""/>
133+
</span>
134+
</div>
135+
<div class="pf-v5-c-input-group__item">
136+
<button class="pf-v5-c-button pf-m-control" type="button" aria-label="Show password"
137+
aria-controls="password" data-password-toggle
138+
data-icon-show="fa-eye fas" data-icon-hide="fa-eye-slash fas"
139+
data-label-show="Show password" data-label-hide="Hide password">
140+
<i class="fa-eye fas" aria-hidden="true"></i>
141+
</button>
142+
</div>
143+
</div>
144+
145+
<div id="input-error-container-password">
146+
</div>
147+
</div>
148+
149+
150+
<div class="pf-v5-c-form__group">
151+
</div>
152+
153+
<input type="hidden" id="id-hidden-input" name="credentialId" />
154+
<div class="pf-v5-c-form__group">
155+
<div class="pf-v5-c-form__actions">
156+
<button class="pf-v5-c-button pf-m-primary pf-m-block " name="login" id="kc-login" type="submit">Sign In</button>
157+
</div>
158+
</div>
159+
</form>
160+
</div>
161+
</div>
162+
163+
164+
165+
</div>
166+
<div class="pf-v5-c-login__main-footer">
167+
<!-- template: login.ftl -->
168+
169+
170+
</div>
171+
</main>
172+
173+
</div>
174+
</div>
175+
</html>

0 commit comments

Comments
 (0)