Documentation ¶
Overview ¶
****************************************************************************** * * Copyright 2022 SAP SE * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You should have received a copy of the License along with this * program. If not, you may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************************
Index ¶
- type Identity
- type Keystone
- func (d Keystone) AuthOptions() *gophercloud.AuthOptions
- func (d Keystone) Authenticate(credentials *gophercloud.AuthOptions) (policy.Context, error)
- func (d Keystone) Client() (*gophercloud.ProviderClient, error)
- func (d Keystone) DomainName(id string) (string, error)
- func (d Keystone) GroupName(id string) (string, error)
- func (d Keystone) ProjectName(id string) (string, error)
- func (d Keystone) RefreshToken() error
- func (d Keystone) RoleName(id string) (string, error)
- func (d Keystone) UserID(name string) (string, error)
- func (d Keystone) UserName(id string) (string, error)
- func (d Keystone) ValidateToken(token string) (policy.Context, error)
- type Mock
- func (d Mock) AuthOptions() *gophercloud.AuthOptions
- func (d Mock) Authenticate(credentials *gophercloud.AuthOptions) (policy.Context, error)
- func (d Mock) Client() (*gophercloud.ProviderClient, error)
- func (d Mock) DomainName(id string) (string, error)
- func (d Mock) GroupName(id string) (string, error)
- func (d Mock) ProjectName(id string) (string, error)
- func (d Mock) RoleName(id string) (string, error)
- func (d Mock) UserID(name string) (string, error)
- func (d Mock) UserName(id string) (string, error)
- func (d Mock) ValidateToken(token string) (policy.Context, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Identity ¶
type Identity interface { // Return the main gophercloud client from which the respective service // clients can be derived. For Mock drivers, this returns nil, so test code // should be prepared to handle a nil Client() where appropriate. Client() (*gophercloud.ProviderClient, error) AuthOptions() *gophercloud.AuthOptions /********** requests to Keystone **********/ ValidateToken(token string) (policy.Context, error) Authenticate(credentials *gophercloud.AuthOptions) (policy.Context, error) DomainName(id string) (string, error) ProjectName(id string) (string, error) UserName(id string) (string, error) UserID(name string) (string, error) RoleName(id string) (string, error) GroupName(id string) (string, error) }
Identity is an interface that wraps the authentication of the service user and token checking of API users. Because it is an interface, the real implementation can be mocked away in unit tests.
type Keystone ¶
type Keystone struct {
TokenRenewalMutex *sync.Mutex // Used for controlling the token refresh process
}
Keystone Openstack Keystone implementation
func (Keystone) AuthOptions ¶
func (d Keystone) AuthOptions() *gophercloud.AuthOptions
AuthOptions fills in Keystone options with hermes config values
func (Keystone) Authenticate ¶
func (d Keystone) Authenticate(credentials *gophercloud.AuthOptions) (policy.Context, error)
Authenticate with Keystone
func (Keystone) Client ¶
func (d Keystone) Client() (*gophercloud.ProviderClient, error)
Client for Keystone connection
func (Keystone) DomainName ¶
DomainName with caching
func (Keystone) ProjectName ¶
ProjectName with caching
func (Keystone) RefreshToken ¶
RefreshToken fetches a new Identity auth token. It is also used to fetch the initial token on startup.
type Mock ¶
type Mock struct{}
Mock TODO: emnpty struct? Is there a better way?
func (Mock) AuthOptions ¶
func (d Mock) AuthOptions() *gophercloud.AuthOptions
AuthOptions for mocking keystone
func (Mock) Authenticate ¶
func (d Mock) Authenticate(credentials *gophercloud.AuthOptions) (policy.Context, error)
Authenticate for Mocking Keystone
func (Mock) Client ¶
func (d Mock) Client() (*gophercloud.ProviderClient, error)
Client for mocking keystone
func (Mock) DomainName ¶
DomainName for mocking keystone
func (Mock) ProjectName ¶
ProjectName for mocking keystone