15 Commits
Author SHA1 Message Date
Mathias ZellerandHidetake Iwata 5aaf30b930 fix: make id_token optional during refresh when using access tokens (#1558)
When useAccessToken is enabled, some OIDC providers (e.g. PingFederate)
do not return an id_token on refresh_token grants. Previously, verifyToken()
unconditionally required id_token before checking the useAccessToken flag,
causing every token refresh to fail and fall back to the browser-based
authorization code flow.

Restructure verifyToken() so that when useAccessToken is enabled, the
access token is verified directly and the id_token is only verified if
present. The standard id_token flow when useAccessToken is disabled
remains unchanged.

Fixes int128/kubelogin#536

Signed-off-by: Mathias Zeller <mathias.zeller@mercedes-benz.com>
Co-authored-by: Hidetake Iwata <int128@gmail.com>
2026-05-30 16:36:59 +09:00
Hidetake Iwata 7fc48592de Use Endpoint.DeviceAuthURL of oauth2 package (#1372) 2025-07-13 13:54:55 +09:00
Hidetake IwataandCopilot fd9d3a8e9d Split oidc/client.go (#1371)
* Split oidc/client.go

* Refactor

* Fix

* Improve comment

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-13 13:23:33 +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
Hidetake Iwata db764cd328 Use PKCE verifier of oauth2 package (#1340) 2025-05-19 18:51:43 +09:00
Hidetake Iwata 898e8a12de Refactor PKCE implementation (#1239) 2025-01-12 21:41:20 +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
renovate[bot] 974369fe6f fix(deps): update module golang.org/x/oauth2 to v0.8.0 (#922) 2023-05-14 19:19:18 +09:00
Bastian cda2eccaac feat(authentication): add oauth2 device grant (#837) 2022-12-22 08:03:10 +09:00
Hidetake Iwata 7152bccd21 refactor: migrate to Testify Mock (#739) 2022-07-16 16:55:51 +09:00
44ffd69cbf Update module coreos/go-oidc to v3 (#463)
* Update module coreos/go-oidc to v3

* Update import path to github.com/coreos/go-oidc/v3/oidc

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Hidetake Iwata <int128@gmail.com>
2021-02-11 17:23:22 +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