110 Commits
Author SHA1 Message Date
Christian Nuss d55963b7ff fix: include oidc-auth-request-extra-params in token cache key (#1497)
The token cache key computation did not include the AuthRequestExtraParams
values from the --oidc-auth-request-extra-params flag. This caused tokens
with different extra parameters (e.g., different audience values) to
incorrectly share the same cache entry.

Changes:
- Add AuthRequestExtraParams field to tokencache.Key struct
- Add AuthRequestExtraParams() method to GrantOptionSet to extract
  extra params from whichever grant option is set
- Update get_token.go to include extra params in cache key
- Add comprehensive tests for cache key differentiation

Fixes #1496
2026-03-01 10:33:54 +09:00
a301ec17a7 chore(deps): update golang docker tag to v1.26.0 (#1502)
* chore(deps): update golang docker tag to v1.26.0

* Fix printf args

Error: pkg/usecases/setup/setup.go:86:18: non-constant format string in call to (github.com/int128/kubelogin/pkg/infrastructure/logger.Interface).Printf

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hidetake Iwata <int128@gmail.com>
2026-02-22 19:01:27 +09:00
Hidetake Iwata b05e92d466 Remove deprecated flag --oidc-redirect-url-hostname (#1450) 2025-11-24 16:48:14 +09:00
Hidetake IwataandMaximilian Blatt 3981c78387 Add --oidc-request-header flag (#1359)
* fix(authcode): Set Origin header on token request

Allow passing Azure AD CORS checks.

on-behalf-of: @eon-se opensource@eon.com
Signed-off-by: Maximilian Blatt <maximilian.blatt.external@eon.com>

* Add `--oidc-request-header` flag

* Add doc

---------

Signed-off-by: Maximilian Blatt <maximilian.blatt.external@eon.com>
Co-authored-by: Maximilian Blatt <maximilian.blatt.external@eon.com>
2025-07-13 11:04:40 +09:00
Clay B.andHidetake Iwata cefacba2d2 Support Client Credentials Flow (#1231)
* Issue 931: Support Client Credentials Flow

* Move client-credentials to use --oidc-auth-request-extra-params

* Missed a file in moving to --oidc-auth-request-extra-params

* Support --oidc-use-access-token

* make generate

---------

Co-authored-by: Hidetake Iwata <int128@gmail.com>
2025-06-16 14:16:58 +09:00
Hidetake Iwata 0f2f54d4bf Add --oidc-redirect-url to override redirect URL (#1263) 2025-06-16 13:42:48 +09:00
Clay B.andHidetake Iwata 751f5f72c7 Provide a token-cache-storage type of none (#1285)
Co-authored-by: Hidetake Iwata <int128@gmail.com>
2025-05-13 21:52:09 +09:00
Hidetake Iwata bc7e71f586 Change default token cache storage to disk (#1264)
* Change default token cache storage to disk

* Fix

* Fix

* Clean up both storages
2025-01-30 18:47:07 +09:00
Hidetake Iwata 3a38753ee7 Refactor setup command and docs (#1253)
* Refactor setup command and docs

* Fix slice flags

* Fix
2025-01-25 16:08:28 +09:00
Hidetake Iwata a2a6ea229d Improve docs (#1250)
* Refactor docs

* Update --exec-api-version

* Add device authorization grant

* Fix
2025-01-19 15:02:02 +09:00
Hidetake Iwata e31ad59e63 Add clean command (#1248)
* Add clean command

* Refactor

* Refactor
2025-01-18 22:24:23 +09:00
Hidetake Iwata aa1f445672 Rename flag to --oidc-pkce-method and improve docs (#1240)
* Add --oidc-pkce-method and improve docs

* Fix lint

* Refactor

* Refactor
2025-01-14 09:57:19 +09:00
Hidetake Iwata 898e8a12de Refactor PKCE implementation (#1239) 2025-01-12 21:41:20 +09:00
Hidetake Iwata 606f1cd0b6 Remove unused struct field (#1238) 2025-01-12 15:55:26 +09:00
Hidetake Iwata 6f62b25c40 Extract struct tokencache.Config (#1226) 2025-01-11 16:44:56 +09:00
Hidetake Iwata c66570c030 Remove unused struct member (#1224) 2025-01-08 12:50:15 +09:00
kalle (jag)andHidetake Iwata afb25f511c Added key cache via OS keyring (#973)
* Added key cache via OS keyring

* Fix lint issue

* Disable keyring in integration tests

* Disable keyring in system test

---------

Co-authored-by: Hidetake Iwata <int128@gmail.com>
2025-01-08 12:32:26 +09:00
Hidetake Iwata 0e9a39a571 Infer apiVersion from KUBERNETES_EXEC_INFO environment variable (#1162)
* Infer apiVersion from KUBERNETES_EXEC_INFO

* Test client.authentication.k8s.io/v1

* Set --exec-interactive-mode

* Set --exec-interactive-mode=Never

* Fix comments
2024-11-03 17:21:25 +09:00
Hidetake Iwata f1f2a37adc Include essential options to token cache key (#1161) 2024-10-26 21:42:23 +09:00
Hidetake Iwataandlnx01 438068e9de refactor: Move useAccessToken to oidc.Provider (#1160)
* refactor: Move useAccessToken to oidc.Provider

* Generated by GitHub Actions (go / generate)

https://github.com/int128/kubelogin/actions/runs/11530911738

---------

Co-authored-by: update-generated-files-action <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-26 21:07:44 +09:00
Hidetake Iwata 3d114bfeba Lock token cache file before authentication (#1126)
* Lock token cache file in authentication

* Fix tests

* make generate

* Lock before FindByKey

* Fix test
2024-09-21 14:54:32 +09:00
Hidetake Iwata 66127ff3fc Migrate to mockery packages feature (#1124)
* Migrate to mockery packages feature

* Fix workflow
2024-08-17 12:27:13 +09:00
Adam KafkaandAdam kafka 905238ce07 Add new --oidc-use-access-token flag to get-token (#1084)
* Add new `--oidc-use-access-token` flag to `get-token`

Implements https://github.com/int128/kubelogin/issues/1083. See
description there for context.

In its current form, this PR is bare bones functionality. I have not yet
added any tests to confirm this behavior. Additionally, we could
consider updtating some of the naming. It is confusing to return a
`TokenSet` where `IDToken` actually has an `accessToken`. I'm open to
feedback on how best to improve this.

However, this PR is functional. I have validated it locally. Without
adding `--oidc-use-access-token`, and `id_token` is successfully
returned. Adding `--oidc-use-access-token` results in an `access_token`
being successfully returned.

* Fix failing tests

Needed to plumb through our new parameter `UseAccessToken` to the mocks
as well.

* Add a test to make sure new flag is plumbed through

* Support Access Tokens whose audience differ from the client_id

As noted in the PR, there are some cases where the access token `aud`
field will not be the `client_id`. To allow for these, we use a
different token verifier that will not verify that claim.

---------

Co-authored-by: Adam kafka <akafka@tesla.com>
2024-08-16 16:57:05 +09:00
Hidetake Iwata 622dc5ba0b Refactor #944 (#951) 2023-06-24 15:26:39 +09:00
Reza Nikoopour 069ff68d99 Added flag to let user set redirect uri for authcode-keyboard (#944) 2023-06-23 16:53:55 +09:00
9e2fcd8cdb fix(deps): update module github.com/golang-jwt/jwt/v4 to v5 (#925)
* fix(deps): update module github.com/golang-jwt/jwt/v4 to v5

* Replace with `jwt.RegisteredClaims`

* Replace with `jwt.NewNumericDate`

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hidetake Iwata <int128@gmail.com>
2023-05-14 21:38:48 +09:00
Hidetake Iwataandlnx01 10412effa2 Run go fmt (#866)
* Run go fmt

* Generated by GitHub Actions (go / generate)

https://github.com/int128/kubelogin/actions/runs/4971610724

---------

Co-authored-by: update-generated-files-action <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-14 18:21:55 +09:00
Martin Linkhorst f03d4fe821 get-token: add --force-refresh flag to refresh ID token (#879) 2023-02-17 15:25:11 +09:00
Hidetake Iwata adfbc48b24 Handle verification_url field in device flow (#846) 2022-12-24 19:10:21 +09:00
Hidetake Iwata 345465a5d3 Refactor test (#847) 2022-12-24 17:00:59 +09:00
Bastian cda2eccaac feat(authentication): add oauth2 device grant (#837) 2022-12-22 08:03:10 +09:00
Huang Huang 3602948645 Correct the --listen-address flag at stage 2 instructions (#815) 2022-10-16 14:26:54 +09:00
Hidetake Iwata 7152bccd21 refactor: migrate to Testify Mock (#739) 2022-07-16 16:55:51 +09:00
Hidetake Iwata 775841a72b Remove deprecation of standalone mode (#680)
* Remove deprecation of standalone mode

* Update standalone-mode.md
2022-01-08 17:48:00 +09:00
Hidetake Iwata 237e53313d Add flag to set custom browser command (#622)
* Add flag to set custom browser command

* Use --browser-command in system_test

* Add --browser-command= to setup message
2021-09-05 11:35:03 +09:00
Pedro Kiefer a0cfde7198 refactor: add --oidc-use-pkce flag to force PKCE authorization flow (#599) 2021-08-04 06:38:26 +09:00
Hidetake Iwata 8e1a63b1a2 Change mutex scope to bind address port (#430) 2020-11-23 17:41:07 +09:00
Hidetake Iwata ebf81debe1 Refactor: credentialplugin/get_token_test.go (#429)
* Refactor: extract const vars

* Refactor: extract ROPC test case
2020-11-22 20:01:45 +09:00
Hidetake Iwata 2f271b5870 Refactor: replace Input fields with oidc.Provider (#428) 2020-11-21 12:35:23 +09:00
Hidetake Iwata b1d8e8f7e1 Refactor: rewrite with Go errors package (#427) 2020-11-21 12:10:42 +09:00
Hidetake Iwata 5a3227409c Refactor: rename to infrastructure package (#426) 2020-11-21 07:56:52 +09:00
Hidetake Iwata 13d232ec21 Refactor: move oidc/client package (#425) 2020-11-21 07:27:34 +09:00
Hidetake Iwata 9bab6b2ccd Refactor: extract tokencache and repository package (#424) 2020-11-20 07:01:16 +09:00
Hidetake Iwata 93fc548544 Refactor: extract kubeconfig package (#423)
* Refactor: extract kubeconfig package

* Refactor: use pass by value instead of reference
2020-11-18 10:36:42 +09:00
Hidetake Iwata 4773b67abd Refactor: extract credentialplugin package (#422) 2020-11-18 10:00:39 +09:00
Hidetake Iwata 34762216c1 Refactor: extract tlsclientconfig.Config (#409) 2020-11-03 14:37:24 +09:00
Eric PoitrasandHidetake Iwata 878847f937 feat(389): Prevent concurrent authentication using a lockfile. (#397)
* feat(389): Prevent concurrent authentication using a lockfile to protect the local port allocation.

* Fix test

* Refactor: inline values

Co-authored-by: Hidetake Iwata <int128@gmail.com>
2020-10-25 14:32:53 +09:00
Hidetake Iwata b701a6f0aa Refactor: aggregate test cases to lease and full options (#406) 2020-10-25 12:24:35 +09:00
Christoph Stäbler d1b89e3d38 Add username in token cache key (#404) 2020-10-24 20:44:29 +09:00
Hidetake Iwata 64bfc5a465 Refactor authentication use-cases (#395) 2020-10-03 20:01:26 +09:00