Documentation
¶
Overview ¶
Package iam provides a client for the Red Hat User Service, used to resolve a user's organization id (org_id) from their username (SSO login/principal).
Index ¶
Constants ¶
const AccountTypeOrganization = "organization"
AccountTypeOrganization is the account type for an organization.
const AccountTypePerson = "person"
AccountTypePerson is the account type for an individual.
Variables ¶
var ErrAccountNotFound = errors.New("account not found")
ErrAccountNotFound is returned when the User Service cannot find the requested account.
var ErrOrgNotFound = errors.New("no org_id found for username")
ErrOrgNotFound is returned when the User Service has no organization (account relationship) for the requested username.
Functions ¶
This section is empty.
Types ¶
type AccountInfo ¶ added in v0.29.0
type AccountInfo struct {
ID string // account id
Name string // account name
EBSAccountNumber string // ebsAccountNumber
Status string // enabled/disabled/etc
Type string // organization/person/etc
}
AccountInfo contains account details returned by findAccount.
type Client ¶
type Client interface {
// FindUser returns user info including org_id and personal details by username.
FindUser(ctx context.Context, username string) (*UserInfo, error)
// FindAccount retrieves account details by account ID.
FindAccount(ctx context.Context, accountID string) (*AccountInfo, error)
}
Client resolves user and organization information from the User Service.
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient talks to the User Service over an mTLS-authenticated HTTPS connection.
func NewHTTPClient ¶
func NewHTTPClient(config Config) (*HTTPClient, error)
NewHTTPClient builds an HTTPClient that authenticates with the User Service using the given PEM-encoded client certificate and private key.
func (*HTTPClient) FindAccount ¶ added in v0.29.0
func (c *HTTPClient) FindAccount(ctx context.Context, accountID string) (*AccountInfo, error)
type MockClient ¶
type MockClient struct {
}
MockClient is a mock implementation of Client for testing.
func (*MockClient) FindAccount ¶ added in v0.29.0
func (m *MockClient) FindAccount(ctx context.Context, accountID string) (*AccountInfo, error)
type UnimplementedClient ¶
type UnimplementedClient struct{}
UnimplementedClient is a no-op client that always returns errors.
func (*UnimplementedClient) FindAccount ¶ added in v0.29.0
func (c *UnimplementedClient) FindAccount(_ context.Context, _ string) (*AccountInfo, error)