dex
dex copied to clipboard
Expose GetPassword via the GRPC API
GetPassword was already wired up to storage and everything, just took a bit more work to wire it through the API. This will be super helpful when building things on top of Dex as you can retrieve a password without enumerating the entire store via ListPasswords.
@ericchiang What do you think about this one?
While #1020 would resolve our need for using dex for user storage, as long as that's the case, this addition would let us simplify all the place where we're currently going with
resp, err := s.c.ListPasswords(ctx, &api.ListPasswordReq{})
if err != nil {
return nil, errors.Wrap(err, "get password")
}
// searches returned users for user
for _, p := range resp.Passwords {
if p.Email == email {
usr := users.ShowUser{
ID: p.UserId,
Name: p.Username,
Email: p.Email,
}
return &usr, nil
}
}
return nil, &users.NotFoundError{}
...and, since it doesn't seem too big a deal for dex' GRPC API, I'd think it's a good addition 😉
Can we do #1272 instead?
@ericchiang well, these two are rather complementary... 🤔 Or am I missing something? VerifyPassword wouldn't be of much use for simplifying this, would it?
@sagikazarmark @nabokihms I'm writing an internal component which relies on the gRPC API and I stumbled upon this issue while looking for a way the check if a certain Password/User exists in dex.
Is there any plan to include such an endpoint in the API?