-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add isValidUsername method #11
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #11 +/- ##
============================================
+ Coverage 95.58% 96.08% +0.49%
- Complexity 77 88 +11
============================================
Files 5 5
Lines 204 230 +26
Branches 39 44 +5
============================================
+ Hits 195 221 +26
Misses 7 7
Partials 2 2 ☔ View full report in Codecov by Sentry. |
badlist.add(user); | ||
} | ||
} | ||
final URI target = rootURI.resolve("api/V2/users/?list=" + String.join(",", badlist)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see if my understanding is correct.
badlist
may consist gibberish usernames and expired ones. And you call api/V2/users/
to distinguish them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
badlist contains any usernames that don't exist in the cache and are valid usernames, and the endpoint returns extant usernames mapped to their display names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saw your test examples. Make sense now. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
throws IOException, AuthException { | ||
// theoretically someone could submit hundreds of users and hit the url size limit | ||
// don't worry about that for now. | ||
checkToken(token); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a valid token for this? I can see a case (mainly at account creation) where you don't have your own username yet, thus no token (maybe a temp token via an auth provider?), and you want to see if your username is available or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this endpoint requires a token. For the use case you're talking about there's https://github.com/kbase/auth2/blob/develop/src/main/java/us/kbase/auth2/service/ui/Login.java#L136-L150
No description provided.