iam

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const AccountTypeOrganization = "organization"

AccountTypeOrganization is the account type for an organization.

View Source
const AccountTypePerson = "person"

AccountTypePerson is the account type for an individual.

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 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 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) FindAccount added in v0.29.0

func (c *HTTPClient) FindAccount(ctx context.Context, accountID string) (*AccountInfo, error)

func (*HTTPClient) FindUser

func (c *HTTPClient) FindUser(ctx context.Context, username string) (*UserInfo, 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)

func (*MockClient) FindUser

func (m *MockClient) FindUser(_ context.Context, username string) (*UserInfo, 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)

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