iam

package
v0.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

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

View Source
var ErrAccountNotFound = errors.New("account not found")

ErrAccountNotFound is returned when the User Service cannot find the requested account.

View Source
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 Config added in v0.25.0

type Config struct {
	URL                string
	ClientCert         []byte
	ClientKey          []byte
	InsecureSkipVerify bool
}

Config configures an HTTP client for 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) FindOrg

func (c *HTTPClient) FindOrg(ctx context.Context, orgID string) (*OrgInfo, error)

func (*HTTPClient) FindUser

func (c *HTTPClient) FindUser(ctx context.Context, username string) (*UserInfo, error)

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.

func (*MockClient) FindOrg

func (m *MockClient) FindOrg(_ context.Context, orgID string) (*OrgInfo, error)

func (*MockClient) FindUser

func (m *MockClient) FindUser(_ context.Context, username string) (*UserInfo, error)

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.

func (*UnimplementedClient) FindOrg

func (c *UnimplementedClient) FindOrg(_ context.Context, _ string) (*OrgInfo, error)

func (*UnimplementedClient) FindUser

func (c *UnimplementedClient) FindUser(_ context.Context, _ string) (*UserInfo, error)

type UserInfo

type UserInfo struct {
	OrgID     string // accountId from accountRelationships
	FirstName string // from personalInformation
	LastName  string // from personalInformation (lastNames)
}

UserInfo contains user identity and organization details.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL