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 ¶
This section is empty.
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 Client ¶
type Client interface {
// FindUser returns user info including org_id and personal details by username.
FindUser(ctx context.Context, username string) (*UserInfo, error)
// FindOrg retrieves organization details by org_id.
FindOrg(ctx context.Context, orgID string) (*OrgInfo, 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.
type MockClient ¶
type MockClient struct {
FindUserFunc func(ctx context.Context, username string) (*UserInfo, error)
FindOrgFunc func(ctx context.Context, orgID string) (*OrgInfo, error)
}
MockClient is a mock implementation of Client for testing.
type OrgInfo ¶
type OrgInfo struct {
ID string // account id
Name string // organization name
EBSAccountNumber string // ebsAccountNumber
Status string // enabled/disabled/etc
Type string // organization/individual/etc
}
OrgInfo contains organization account details.
type UnimplementedClient ¶
type UnimplementedClient struct{}
UnimplementedClient is a no-op client that always returns errors.