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:
parent
784256a823
commit
301e6d4cb8
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue