Repository navigation
Conversation
| ### | ||
| ### This does not impact the behavior of the token, but can be useful for debugging. | ||
| ### For example this could be used to differentiate between anonymous accounts, personal access tokens, or service accounts. | ||
| kind: String, default="" |
There was a problem hiding this comment.
This might be useful here, to then also later check that tokens of a specific kind are e.g. updated to the latest desired behavior (max lifetime, automatic expiration etc.).
I suppose this could also be useful on the AuthUser itself, if we don't purely assume them being "humans".
There was a problem hiding this comment.
Is this usually called label?
There was a problem hiding this comment.
label to me sounds more like description.
The usage I envision would be more like kind or type, meaning there should be a small, finite set of options (we probably would also need to index these, as they can be passed in the list query).
There was a problem hiding this comment.
@SandPod In the auth_session we also store the method for now it was created:
Just FYI, I am also not entirely clear what would be best here.
| class: ApiToken | ||
| serverOnly: true | ||
| table: serverpod_auth_session | ||
| fields: |
There was a problem hiding this comment.
Maybe this also needs something like extraClaims (also exposed on the AuthenticationInfo), so one can easily add extra checks (e.g. what a personal access token should be able to do, if it's e.g. just for a specific resource, etc.)
There was a problem hiding this comment.
Hmm, should we in that case also add it to the db backed session token?
There was a problem hiding this comment.
As mentioned earlier, I think it'd be better to use a separate table for any more advanced usage here, to get fully typed access.
"kind" just seems to common that we might want to provide it by default (some for the auth user), but after that more details should probably be looked up in a better interface.
(For the JWT tokens I also would hope that the primary consumer of that info are 3rd party systems extracting the Serverpod-generated token, and not the server itself, which probably has more up to date info about those claims – unless someone wants to really avoid DB lookups.)
cd0daf8 to
b8ca1c4
Compare
| @@ -0,0 +1,49 @@ | |||
| class: ApiToken | |||
There was a problem hiding this comment.
@SandPod As discussed last week, you might want to give the model spec a look here upfront, to make sure that we align on the breadth of this module.
I think the implementation follows from this one quite naturally.
There was a problem hiding this comment.
I think the overall design looks good, I'm wondering if reate-limiting should be something to consider for an api token?
Maybe that should be built into the authenticationHandler directly?
There was a problem hiding this comment.
Sounds nice, I think we could optionally support this (if configured on the token).
Maybe we can even keep the storage requirements low, but using a sliding window (for the configured timeframe) and then just "upsert" a counter (so we always have indexed reads for checks and never COUNT queries). (Though still wondering whether we would store this on the API token row itself or externally (for better history).)
35058d6 to
76634d8
Compare
76634d8 to
89593b7
Compare
|
@SandPod I meant to remove you here, but the UI added you again. As mentioned in #3578 (comment), this can now be closed as the entire functionality is available in the extended I'll do a quick PR to remove the "dummy" API token package shortly. |

No description provided.