8000 Extend the API with a function which updates the client configuration by ccojocar · Pull Request #1275 · dexidp/dex · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Extend the API with a function which updates the client configuration #1275

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

Merged
merged 8 commits into from
Nov 27, 2018

Conversation

ccojocar
Copy link
Contributor
@ccojocar ccojocar commented Aug 8, 2018

No description provided.

@ccojocar
Copy link
Contributor Author
ccojocar commented Oct 3, 2018

@srenatus Any chance to get this merged soon? Thanks

@ccojocar
Copy link
Contributor Author
ccojocar commented Nov 7, 2018

@srenatus Do you see any issues which prevent merging this PR?

Copy link
Contributor
@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for radio silence on this for so long. Thank you for your contribution. 😃

Looks good so far -- I think the UpdateClientReq needs some wrappers (see inline comments). Also, to confidently merge this, I'd need some tests; do you think you could add some here? I guess we currently don't have too much in place around the client bits of the API, but that's for no good reason as far as I can tell... 🤔

server/api.go Outdated
if req.TrustedPeers != nil && len(req.TrustedPeers) > 0 {
old.TrustedPeers = req.TrustedPeers
}
old.Public = req.Public
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, we're "patchy" for Name and LogoUrl -- empty-string means no update -- but not for Public? There is ways to do this in GRPC, so I wonder if we want to do that.

Concretely, if Public was of type BoolValue, we could differentiate "not provided" from "false". I suppose if we do that, we should do the same with the other fields; as you currently cannot

  • unset trusted peers
  • unset redirect URIs
  • set the name to empty-string
  • set the logoURL to empty-string

💭 I guess one could argue whether this is needed. But as it stands, you cannot update the client without setting its public value; that at least should be fixed IMHO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be your suggestion in this case? if it is a private client and the user tries to update to public we should return an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that I need to use an external package in the proto file in order to get these types working.

import "google/protobuf/wrappers.proto";

Some details here: golang/protobuf#438

I can't get it working. If you have any suggestion how to make this working, I am up to it.

An alternative solution is to not update the Public field in the update operation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to address your concerns in the last commit. Please let me know if this solution is fine for you.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm not sure how to best deal with this one. An alternative to introducing wrappers could be to use a FieldMask in UpdateClientReq. And of course, we could just leave it as-is. What do you think, @ericchiang?

Re 49fa5ee, I'm not sure I follow... From what I can tell, it's now an append-only operation? I.e. whatever is in the UpdateClientReq.RedirectUris will be added to old.RedirectUris; but nothing could ever get removed? I'm not sure if this really is what we want... I think something like

		if req.RedirectUris != nil {
			old.RedirectURIs = req.RedirectUris
		}

would do the trick -- it lets you determine what the RedirectUris are after the update, and it allows you to set them to []string{}. Before, what last thing wasn't possible (unless I'm mistaken). Likewise for TrustedClients.

Thanks for bearing with me here 😃

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄 This was what I understood from your first comment. I reverted the last commit, and also allow to update the redirect URIs and trusted peers to []string{}.

The Public filed update was removed as well. I think is not required to be updated after the initial registration.

Hope this is what you are expecting! Thanks

@ccojocar
Copy link
Contributor Author

@srenatus I addressed the review issues and also add some tests. Do you have any other concerns? Thanks

@srenatus
Copy link
Contributor

@ccojocar thanks for adding those tests 👍 -- I'm not sure I understand how the other comment has been resolved, though; so I've unresolved it 😄

@ccojocar
Copy link
Contributor Author
ccojocar commented Nov 26, 2018

@srenatus Are there any pending issues related to this PR?

@srenatus
Copy link
Contributor

@ccojocar thanks for the bump. I'll look into this again today. 😃

Copy link
Contributor
@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bearing with me 😄 Sorry this has been dangling for a while.

api/api.proto Outdated
string id = 1;
repeated string redirect_uris = 2;
repeated string trusted_peers = 3;
bool public = 4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should either just overwrite the public field with whatever was in the UpdateClientReq (what you had pushed before; sorry about that) -- and ensure that documentation makes it obvious that the behaviour isn't patchy when it comes to public; or keep the code as-is and remove the field from this message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to remove the public field since is not used. Please could you point me to the documentation, which should I update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filed is removed.

Copy link
Contributor
@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for implementing this! 🎉

Re: docs -- it seems like the only docs we really have are the comments on the messages. Adding a note there that public cannot (currently) be updated seems superfluous, as there clearly is no public field. So, I think this is OK now. 👍

@srenatus srenatus merged commit f3acec0 into dexidp:master Nov 27, 2018
@srenatus
Copy link
Contributor

Ooops, I've merged this without checking the commits. I guess this could have been a candidate for a squash before merging. My fault! 😅

mmrath pushed a commit to mmrath/dex that referenced this pull request Sep 2, 2019
Extend the API with a function which updates the client configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0