Authorization failed with project id

The keystone response 401 unauthorised ERROR when
use Project ID to get token.

Change-Id: I4f9b361d93127ae8fd6d44d45420095726c288b4
Closes-Bug: #1625967
This commit is contained in:
wujian 2016-09-21 16:06:20 +08:00 committed by wujian
parent 784256a823
commit 301e6d4cb8
6 changed files with 12 additions and 8 deletions

View File

@ -46,7 +46,7 @@ func main() {
// Authenticate with a project name, username, password.
creds = openstack.AuthOpts{
AuthUrl: config.Host,
Project: config.ProjectName,
ProjectName: config.ProjectName,
Username: config.Username,
Password: config.Password,
}
@ -63,7 +63,7 @@ func main() {
// Authenticate with a project id, username, password.
creds = openstack.AuthOpts{
AuthUrl: config.Host,
Project: config.ProjectID,
ProjectId: config.ProjectID,
Username: config.Username,
Password: config.Password,
}

View File

@ -34,7 +34,7 @@ func main() {
// Authenticate with a project name, username, password.
creds := openstack.AuthOpts{
AuthUrl: config.Host,
Project: config.ProjectName,
ProjectName: config.ProjectName,
Username: config.Username,
Password: config.Password,
}

View File

@ -30,7 +30,7 @@ func main() {
// Authenticate with a username, password, tenant id.
creds := openstack.AuthOpts{
AuthUrl: config.Host,
Project: config.ProjectName,
ProjectName: config.ProjectName,
Username: config.Username,
Password: config.Password,
}

View File

@ -29,7 +29,7 @@ const (
func getAuthOpts() openstack.AuthOpts {
return openstack.AuthOpts{
AuthUrl: "http://localhost:5000/v2.0",
Project: "demo",
ProjectName: "demo",
Username: "demo",
Password: "demo",
}

View File

@ -30,7 +30,8 @@ type PasswordCredentials struct {
type OSAuth struct {
PasswordCredentials `json:"passwordCredentials"`
Project string `json:"tenantName"`
ProjectName string `json:"tenantName"`
ProjectId string `json:"tenantId"`
}
type UserPassV2 struct {
@ -59,7 +60,8 @@ func NewUserPassV2(ao AuthOpts) (upv2 *UserPassV2, err error) {
Username: ao.Username,
Password: ao.Password,
},
Project: ao.Project,
ProjectName: ao.ProjectName,
ProjectId: ao.ProjectId,
},
}
return upv2, nil

View File

@ -39,7 +39,9 @@ type AuthOpts struct {
// Project is optional to get an unscoped token but required for
// a scoped token, which is required to do pretty much everything
// except list projects
Project string
ProjectName string
ProjectId string
// Username is required for password auth
Username string