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

Default user domain in password Auth v3 & discarded server error message in Auth #153

Open
tmoinel opened this issue Feb 5, 2020 · 1 comment

Comments

@tmoinel
Copy link

tmoinel commented Feb 5, 2020

When migrating from OVH Keystone API v2.0 to v3 the Authenticate method return Bad Request which isn't very explicit. After debugging it, I see that the server respond with a json error message with the reason but is discarded by the client. We should maybe extend the error type to add the return messages and/or add an error field in v3AuthResponse. I can try to do a PR to add it if it make sens for the project but I have not a good knowledge of this code base.

Reading https://docs.openstack.org/keystone/pike/contributor/http-api.html and the server response :

{
  "error": {
      "message": "Expecting to find domain in user. The server could not comply with the request since it is either malformed or otherwise incorrect. The client is assumed to be in error.",
      "code": 400,
      "title": "Bad Request"
  }
}

I resolve my issue by setting swift.Connection.Domain to default.

I can't find if the user domain is mandatory in the protocol but if it is we should be set to default if it is not provided, like in the project scope

swift/auth_v3.go

Lines 225 to 227 in 017f012

default:
v3.Auth.Scope.Project.Domain = &v3Domain{Name: "Default"}
}

adding an else seems sufficient

swift/auth_v3.go

Lines 197 to 201 in 017f012

if c.Domain != "" {
domain = &v3Domain{Name: c.Domain}
} else if c.DomainId != "" {
domain = &v3Domain{Id: c.DomainId}
}

} else {
	domain = &v3Domain{Name: "Default"}
}

I can make a PR too.

@ncw
Copy link
Owner

ncw commented Feb 6, 2020

After debugging it, I see that the server respond with a json error message with the reason but is discarded by the client.

What error did the client return?

A PR to improve the error message would be appreciated!

Constructing a new error with

swift/swift.go

Line 291 in 017f012

func newErrorf(StatusCode int, Text string, Parameters ...interface{}) *Error {

would probably be the right thing to do.

I can't find if the user domain is mandatory in the protocol but if it is we should be set to default if it is not provided, like in the project scope

I think if you are using v3 auth you are expected to provide a domain. Its a while since I looked at this so my memory is hazy!

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