Skip to content
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

tokenAuth pingClient should not assume the "v2" url is at the root. #1107

Closed
reasonerjt opened this issue Feb 28, 2017 · 2 comments
Closed

Comments

@reasonerjt
Copy link
Contributor

reasonerjt commented Feb 28, 2017

If I host my notary-server under a sub path:
x.x.x.x/notary
I can use the command:

notary -s https://x.x.x.x/notary list ......

to list the targets, however when the "auth" is configured at the notary-server, the command will not challenge me for credentials.

Checked the code:
https://github.com/docker/notary/blob/master/cmd/notary/tuf.go#L892

the "/v2/" url is hard coded to the root, but in my case the notary client should "ping" the url x.x.x.x/notary/v2 instead of x.x.x.x/v2

a quick fix:

var p string
if strings.HasSuffix(endpoint.Path, "/") {
     p = endpoint.Path + "v2/"
} else {
     p = endpoint.Path + "/v2/"
}
subPath, err := url.Parse(p)

can work around the problem.

@ecordell
Copy link
Contributor

ecordell commented Feb 28, 2017

👍 This is important for potential non-container-registry Notary users.

IMO, we should just have a separately configurable auth URL which is perhaps by default tuf_url+ /v2

@reasonerjt
Copy link
Contributor Author

@ecordell
so that's what my fix in OP is doing, I'll open a PR if you think it looks OK.

reasonerjt added a commit to reasonerjt/notary that referenced this issue Mar 1, 2017
Signed-off-by: Tan Jiang <jiangd@vmware.com>
@reasonerjt reasonerjt mentioned this issue Mar 1, 2017
reasonerjt added a commit to reasonerjt/notary that referenced this issue Mar 6, 2017
Signed-off-by: Tan Jiang <jiangd@vmware.com>
@cyli cyli closed this as completed in 4c14e60 Mar 9, 2017
cyli added a commit that referenced this issue Mar 9, 2017
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

No branches or pull requests

2 participants