Skip to content

Commit d6660a6

Browse files
authored
Support lakectl login: client, controller stub (#9644)
* Add LoginToken support to OpenAPI - OpenAPI support - Login tokens abstraction - Controller hookup to login tokens abstraction (This feature is unimplemented in base lakeFS, and only a trivial login tokens abstraction exists here.) * Add releaseTokenToMailbox API This is typically only called by the browser -- but it's still handled as OpenAPI in the controller. * Add `lakectl login` client code * Release token correctly, with usable web page * make gen * [lint] Make govet & golanci-lint pass again * Open browser at login URL * Update `lakectl help` golden file * Use RetryClient in lakectl login Use the same RetryClient type as the rest of lakeFS, only with a different retry policy - one that retries status code 404. This involves refactoring getClient... so do that. * Use different (longer) login retries config * Explicitly redirect to login page from controller during lakectl login releaseToken is _not_ part of the UI, and there is no implicit redirection there from middleware. Instead, redirect there from the controller. * golangci-lint * [bug] Copilot fixes: HTTP header issues, nit in doc * [CR] Limit loginRequestToken length; extract X-Lakefs-Mailbox header * [CR] Retrieve login URL from config when possible * [CR] Fix bug: full redirect after login Authentication changed in #9593. This broke the ability to redirect to a non-React URL after logging in -- which @Isan-Rivkin discovered broke `lakectl login`. Restore the ability to go to the particular route needed under /api/v1. Checked by re-logging-in. * [bug] Correctly encode "next" URL It's a query param that contains "/" and ":" and things - encode it as such! * [bug] Fix golangci-lint: actually copy URL
1 parent e39f13b commit d6660a6

File tree

47 files changed

+4120
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4120
-91
lines changed

api/swagger.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3217,6 +3217,103 @@ paths:
32173217
default:
32183218
$ref: "#/components/responses/ServerError"
32193219

3220+
/auth/get-token/start:
3221+
get:
3222+
tags:
3223+
- auth
3224+
- experimental
3225+
security: [] # This a way to log in, no auth available.
3226+
operationId: getTokenRedirect
3227+
summary: start acquiring a token by logging in on a browser
3228+
responses:
3229+
303:
3230+
description: login on this page, await results on the mailbox URL
3231+
headers:
3232+
Location:
3233+
schema:
3234+
type: string
3235+
description: open this URL on the browser
3236+
X-LakeFS-Mailbox:
3237+
schema:
3238+
type: string
3239+
description: GET the token from this mailbox. Keep the mailbox SECRET!
3240+
401:
3241+
$ref: "#/components/responses/Unauthorized"
3242+
429:
3243+
description: too many requests
3244+
501:
3245+
description: Not implemented in this edition.
3246+
$ref: "#/components/responses/NotImplemented"
3247+
default:
3248+
$ref: "#/components/responses/ServerError"
3249+
3250+
/auth/get-token/mailboxes/{mailbox}:
3251+
parameters:
3252+
- in: path
3253+
name: mailbox
3254+
required: true
3255+
schema:
3256+
type: string
3257+
description: mailbox returned by getTokenRedirect
3258+
get:
3259+
tags:
3260+
- auth
3261+
- experimental
3262+
security: [] # This a way to log in, no auth available.
3263+
operationId: getTokenFromMailbox
3264+
summary: receive the token after user has authenticated on redirect URL.
3265+
responses:
3266+
200:
3267+
description: user successfully logged in
3268+
content:
3269+
application/json:
3270+
schema:
3271+
$ref: "#/components/schemas/AuthenticationToken"
3272+
401:
3273+
description: bad mailbox or user has not logged in yet
3274+
$ref: "#/components/responses/Unauthorized"
3275+
404:
3276+
description: not found or user has not logged in yet
3277+
$ref: "#/components/responses/NotFound"
3278+
429:
3279+
description: too many requests
3280+
501:
3281+
description: not implemented in this edition.
3282+
$ref: "#/components/responses/NotImplemented"
3283+
default:
3284+
$ref: "#/components/responses/ServerError"
3285+
3286+
/auth/get-token/release-token/{loginRequestToken}:
3287+
parameters:
3288+
- in: path
3289+
# The mailbox is secret. It is identified by the loginRequestToken - a JWT which is
3290+
# _not_ secret. So this JWT can safely go in a header.
3291+
name: loginRequestToken
3292+
required: true
3293+
schema:
3294+
type: string
3295+
maxLength: 1024
3296+
description: login request token returned by getTokenRedirect.
3297+
get: # Called by opening a URL on the browser!
3298+
tags:
3299+
- auth
3300+
- experimental
3301+
operationId: releaseTokenToMailbox
3302+
summary: release a token for the current (authenticated) user to the mailbox of this login request.
3303+
responses:
3304+
204:
3305+
description: token released
3306+
401:
3307+
description: bad token or user has not logged in yet
3308+
$ref: "#/components/responses/Unauthorized"
3309+
429:
3310+
description: too many requests
3311+
501:
3312+
description: not implemented in this edition.
3313+
$ref: "#/components/responses/NotImplemented"
3314+
default:
3315+
$ref: "#/components/responses/ServerError"
3316+
32203317
/repositories:
32213318
get:
32223319
tags:

clients/java/README.md

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

clients/java/api/openapi.yaml

Lines changed: 138 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)