-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: CF API client can successfully request an oauth token #1294
Comments
- The CF CLI requires a token endpoint during log streaming - This endpoint provides a token with a valid expiration, which allows the CLI to proceed. The token is not used for actual authentication so it only needs to be in a parsable format. - Eventually the CLI will be updated to skip this call but for now we need it. [#1294] Co-authored-by: Matt Royal <mroyal@vmware.com> Co-authored-by: Julian Hjortshoj <hjortshojj@vmware.com>
Note: Since the token we return isn't secure in any way, and cannot be used to get anything from our API, we figured it doesn't make any difference if we authenticate or not. We discussed this with @acosta11 and @davewalter during implementation. |
Add /oauth/token dummy endpoint [Finishes #1294]
Acceptance:
LGTM, closing. |
Background
The CF CLI logs command makes multiple requests on behalf of the user to logging read endpoint until cancelled. To facilitate the continued streaming of logs, the cli spawns a separate goroutine to also update the oauth token used to authenticate those requests. But when configured for K8s, the log cache client does not authenticate using the oauth token, instead it uses the auth information stored in the user’s kubeconfig file. Ideally, this would also imply that the token refresh is skipped, but this does not appear to be the case. In the absence of that conditional logic, we can stub out a token response under the assumption that it won't be used.
As a CF CLI user
I want the CF CLI to be able to request an oauth token
So that I can use
cf logs
, which tries to keep an oauth token refreshed while streamingAlso in the future, perhaps we could enhance the auth capabilities of the cli and api to facilitate rotation of the user cert used for identity should the installation include something like pinniped for identity management.
Acceptance Criteria
GIVEN an installation of Korifi API
WHEN I I make an authenticated request of the form
THEN I get a successful response of the form
where the content of the token needs to be valid but is arbitrary.
WHEN I I am not authenticated and make a request of the form
THEN I get a 401 Unauthorized response (we should get this for free from our authn middleware)
Dev Notes
The token contents may need to be a valid jwt for the cli to parse the response, but should not be materially used beyond that point. It looks like the expiration time determines when the cli will next try to refresh if anything.
The text was updated successfully, but these errors were encountered: