dex icon indicating copy to clipboard operation
dex copied to clipboard

Expose GetPassword via the GRPC API

Open tylercloke opened this issue 7 years ago • 4 comments

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.

tylercloke avatar Aug 06 '18 18:08 tylercloke

@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 😉

srenatus avatar Sep 21 '18 13:09 srenatus

Can we do #1272 instead?

ericchiang avatar Sep 21 '18 22:09 ericchiang

@ericchiang well, these two are rather complementary... 🤔 Or am I missing something? VerifyPassword wouldn't be of much use for simplifying this, would it?

srenatus avatar Sep 24 '18 10:09 srenatus

@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?

cippaciong avatar Feb 22 '22 13:02 cippaciong