Commit Graph

3722 Commits

Author SHA1 Message Date
Ryan Richard
b79a2ccf7c Add 1.29 and update patch versions in kube-versions.txt; run codegen 2024-02-29 12:00:02 -08:00
Ryan Richard
27d0c58319 Change codegen scripts to work with Kube 1.29
- Also add support for having comments in kube-versions.txt.
- Update boilerplate copyright dates for generated code files.
2024-02-29 11:46:26 -08:00
Ryan Richard
ffadca7f68 Merge pull request #1876 from vmware-tanzu/pinny/bump-deps
Bump dependencies
2024-02-28 08:18:08 -08:00
Pinny
62c086a725 Bump dependencies 2024-02-28 14:02:53 +00:00
Ryan Richard
99781443b0 Merge pull request #1851 from vmware-tanzu/ben/status/jwt-authenticator
Improve JWTAuthenticator Status
2024-02-27 16:41:54 -08:00
Ryan Richard
f498cb3918 wait for JWTAuthenticator to be phase=ready in supervisor warnings test 2024-02-27 15:45:33 -08:00
Benjamin A. Petersen
e8482ab9e9 Update jwtauthenticator unit tests to check actions
- Add test to verify timestamps are particularly updated
- Improve diff output in tests for actions
- Make jwtauthenticator status tests parallel
- Update copyright headers in multiple files
2024-02-27 15:45:32 -08:00
Benjamin A. Petersen
868ff9ed2b Update jwk authenticator status integration tests 2024-02-27 15:45:32 -08:00
Benjamin A. Petersen
42acf8dcce Add Status & tests for jwks key fetching 2024-02-27 15:45:32 -08:00
Benjamin A. Petersen
1c7e7048a8 Update copyright year in modified files 2024-02-27 15:45:32 -08:00
Benjamin A. Petersen
73e4d3144b Add integration tests for JWTAuthenticators
- paired with changes to e2e_test.go, adds Status.Condition assertions
  around JWTAuthenticators
2024-02-27 15:45:32 -08:00
Benjamin A. Petersen
1a633adde6 add WaitForJWTAuthenticatorStatusPhase() integration helper 2024-02-27 15:45:32 -08:00
Benjamin A. Petersen
09bd51f481 fix comment in testlib/client.go 2024-02-27 15:45:32 -08:00
Benjamin A. Petersen
084c3114f4 Improve jwtcachefiller tests
- some format updates
- add timestamp to test
- fix order of expect,actual in some assertions
- remove some commented code no longer needed
2024-02-27 15:45:32 -08:00
Benjamin A. Petersen
47639340ec extract status comparison test helpers 2024-02-27 15:45:32 -08:00
Benjamin A. Petersen
fd14a5794e ldap upstream watcher: rename local var for clarity 2024-02-27 15:45:32 -08:00
Benjamin A. Petersen
a4447fa606 Add .Status to JWTAuthenticator with Conditions,Phase
- "Ready" condition & supporting conditions
- Legacy "Phase" for convenience
- Refactor newCachedJWTAuthenticator() func
  to improve ability to provide additional conditions
- Update JWTAuthenticator.Status type
- Update RBAC for SA to get/watch/update JWTAuthenticator.Status
- Update logger to plog, add tests for logs & statuses
- update Sync() to reduce enqueue when error is config/user managed, perhaps remove validateJWKSResponse()
2024-02-27 15:45:32 -08:00
Ryan Richard
f18d7310a8 Merge pull request #1875 from vmware-tanzu/pinny/bump-deps
Bump dependencies (adds gotoolchain to go.mod) and fix CodeQL and unit test races
2024-02-27 15:43:32 -08:00
Ryan Richard
28251f8b92 Update some comments in go.mod 2024-02-27 14:54:26 -08:00
Ryan Richard
50b54580de Fix races in login_test.go units tests 2024-02-27 14:54:05 -08:00
Ryan Richard
d88883328a Update codeql workflow actions to latest versions and add setup-go
See deprecation of v2 message in README.md at
https://github.com/github/codeql-action

Added setup-go because codeql code scanning stopped working and gave
this error message:
The go.mod file requires version v1.21.3 of Go, but version v1.20.14 is installed. Consider adding an actions/setup-go step to your workflow.
2024-02-27 12:26:32 -08:00
Pinny
ca6687d428 Bump dependencies 2024-02-27 14:03:11 +00:00
Ryan Richard
848d83c496 Merge pull request #1874 from vmware-tanzu/cli_checks_if_stderr_is_tty
"login oidc" CLI command sometimes skips printing auth URL for non-ttys
2024-02-26 14:56:24 -08:00
Ryan Richard
5bd73fc10d "login oidc" CLI command sometimes skips printing auth URL for non-ttys 2024-02-23 12:23:07 -08:00
Ryan Richard
40e548ebf0 Merge pull request #1873 from vmware-tanzu/1864_followup
CLI deciding if token exchange needed should not look at ID token expiry
2024-02-23 12:17:54 -08:00
Ryan Richard
64b0e69430 Update configure-concierge-jwt.md doc with clarifications 2024-02-23 08:37:43 -08:00
Ryan Richard
daec673b81 Add hack/prepare-jwtauthenticator-on-kind.sh 2024-02-23 08:37:43 -08:00
Ryan Richard
01d6bdb497 CLI deciding if token exchange needed should not look at ID token expiry
This fixes a small mistake in PR #1864. When the "pinniped login oidc"
CLI command is deciding if the RFC8693 token exchange is needed, it
should not look at the expiry of the ID token. This mistake would cause
the RFC8693 token exchange to happen when the OIDC provider is not
a Pinniped Supervisor, which would fail because most other providers
do not support that type of token exchange.

It does not matter if the current ID token is close to expiring when
deciding if the RFC8693 token exchange is needed, because the token
exchange is going to yield a new ID token anyway. It does matter if the
current ID token is close to expiring if the CLI decides that it is
not going to perform the token exchange, and this commit does not change
that logic.
2024-02-23 08:37:01 -08:00
Ryan Richard
216fce70aa Merge pull request #1872 from vmware-tanzu/pinny/bump-deps
Bump dependencies
2024-02-23 06:51:43 -08:00
Pinny
5939ce8cc6 Bump dependencies 2024-02-23 14:00:47 +00:00
Ryan Richard
9471ed2d09 Merge pull request #1871 from vmware-tanzu/always_search_groups
Don't skip upstream group memberships when groups scope is not granted
2024-02-22 08:11:08 -08:00
Ryan Richard
0d31e955ae Don't skip upstream group memberships when groups scope is not granted
Background: For dynamic clients, the groups scope is not always allowed
and/or requested by the client, so it will not always be granted by the
Supervisor for an authorization request.

Previously, when the groups scope was not granted, we would skip
searching for upstream groups in some scenarios.

This commit changes the behavior of authorization flows so that even
when the groups scope is not granted we still search for the upstream
group memberships as configured, and we pass the upstream group
memberships into any configured identity transformations. The identity
transformations could potentially reject the user's authentication based
on their upstream group membership.

When the groups scope is not granted, we don't include the groups in
the final Supervisor-issued ID token. This behavior is not changed.
2024-02-21 13:12:18 -08:00
Ryan Richard
5697bb2915 Merge pull request #1870 from vmware-tanzu/pinny/bump-deps
Bump dependencies
2024-02-21 08:07:37 -08:00
Pinny
ca7b27de3f Bump dependencies 2024-02-21 14:02:55 +00:00
Ryan Richard
867468ee66 Merge pull request #1867 from vmware-tanzu/refactor_supervisor_authenticators
Refactor Supervisor to make interface for upstream IDPs, to better separate upstream and downstream concerns
2024-02-20 22:11:52 -08:00
Ryan Richard
4b4a4ad592 Rename a func and collapse applying id transforms into creating session 2024-02-20 14:47:28 -08:00
Ryan Richard
b341e52214 Refactor to move invocation of identity transforms out of IDP interfaces
Each endpoint handler is now responsible for applying the identity
transformations and creating most of the session data, rather than each
implementation of the upstream IDP interface. This shares code better,
and reduces the responsibilities of the implementations of the IDP
interface by letting them focus more on the upstream stuff.

Also refactor the parameters and return types of the IDP interfaces to
make them more clear, and because they can be more focused on upstream
identities (pre-identity transformation). This clarifies the
responsibilities of the implementations of the IDP interface.
2024-02-20 10:45:54 -08:00
Ryan Richard
1e8e7b948e Refactor token endpoint to add interface for IDP upstream refresh 2024-02-20 09:26:34 -08:00
Ryan Richard
1bc13e94f7 Refactor to extract interface for upstream IDP interactions
Create an interface to abstract the upstream IDP from the
authorize, IDP discovery, callback, choose IDP, and login
endpoints. This commit does not refactor the token endpoint,
which will be refactored in a similar way in the next commit.
2024-02-20 09:26:34 -08:00
Ryan Richard
9db87132b1 More refactoring of auth handler and related refactor of upstreamldap
- continued refactoring the auth handler to share more code between
  the two supported browserless flows: OIDC and LDAP/AD
- the upstreamldap package should not know about the concept of
  OIDC granted scopes, so refactored it to be a skipGroups bool
2024-02-20 09:26:34 -08:00
Ryan Richard
9992855cb8 Refactor error handling in authorize endpoint (changes some responses)
- Simplify the error handling in the authorize endpoint by making the
  private helper functions return fosite-style errors, and having
  one place that writes those errors to the response.
- Some types of errors were previously returned as regular http-style
  errors. Those have all been converted to be returned as oauth-style
  errors (which can be redirects to the client), except for http method
  not found errors. This is a change in behavior from the client's point
  of view, but only when those unexpected errors happen. These types of
  errors are more consistent with RFC6749 section 4.1.2.1.
- Avoids using the httperr package for error handling.
- Create a struct for the handler as a first step toward making smaller
  functions with fewer parameters.
2024-02-20 09:26:34 -08:00
Ryan Richard
23dce42a94 Merge pull request #1869 from vmware-tanzu/pinny/bump-deps
Bump dependencies
2024-02-20 09:25:16 -08:00
Pinny
edf92303ae Bump dependencies 2024-02-20 15:57:22 +00:00
Ryan Richard
719cd75f64 Merge pull request #1866 from vmware-tanzu/upgrade_fosite_feb_2024
Upgrade fosite to latest version
2024-02-13 11:25:24 -08:00
Ryan Richard
ceb9973657 Correct doc which explained bug that has since been fixed. 2024-02-13 10:16:41 -08:00
Ryan Richard
cf82cf996e Adjust tests and comments for upgrade to latest version of fosite 2024-02-13 10:16:41 -08:00
Pinny
5c702738cf Bump dependencies 2024-02-13 16:44:20 +00:00
Ryan Richard
485b2271f0 Merge pull request #1864 from vmware-tanzu/cli_use_cached_access_token
login oidc cmd checks access token expiry before doing token exchange
2024-02-09 14:21:05 -08:00
Ryan Richard
dce9409ccc login oidc cmd checks access token expiry before doing token exchange
In the RFC8693 token exchange, the CLI sends your access token and
receives in exchange a new cluster-scoped ID token.

Fix a bug in the CLI. Whenever the "pinniped login oidc" command was
planning to perform the RFC8693 token exchange, it failed to check if
the cached access token was still valid before performing the exchange,
which sends the access token. It instead checked if the cached ID token
was still valid, but that it not relevant in this situation because the
ID token is not going to be used for anything (instead the new ID token
returned by the RFC8693 token exchange will be used for auth).

This bug doesn't actually matter today, because the Supervisor-issued
access and ID tokens always both have the same 2-minute lifetimes.
However, future enhancements may cause them to have different lifetimes
in certain circumstances. Fixing this CLI bug now to prepare for those
potential future enhancements.
2024-02-09 13:33:30 -08:00
Ryan Richard
d5ce48bd4b Convert double-quoted strings to raw strings in login_test.go 2024-02-09 08:38:51 -08:00