keycloakb

package
v2.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ComponentName is the name of the component.
	ComponentName = "keycloak-bridge"
	// Version of the component.
	Version = "1.1"
)

Functions

func ConvertMinutesShift

func ConvertMinutesShift(value string) (int, error)

ConvertMinutesShift converts a string describing a timezone shift to a numeric value

func GenerateInitialCode

func GenerateInitialCode(nbUpperCase int, nbDigits int, nbLowerCase int) string

GenerateInitialCode generates a code of the format UpperCase + digits + LowerCase

func GeneratePassword

func GeneratePassword(policy *string, minLength int, userID string) (string, error)

GeneratePassword generates a password accoring to the policy or minimum length imposed

func GeneratePasswordFromKeycloakPolicy

func GeneratePasswordFromKeycloakPolicy(policy string) (string, error)

GeneratePasswordFromKeycloakPolicy generates a random password respecting the keycloak password policy

func GeneratePasswordNoKeycloakPolicy

func GeneratePasswordNoKeycloakPolicy(minLength int) string

GeneratePasswordNoKeycloakPolicy generates a password of a given length

func LimitRate

func LimitRate(e cs.Endpoint, limit int) endpoint.Endpoint

LimitRate adds a rate limit to an endpoint

func LogUnrecordedEvent

func LogUnrecordedEvent(ctx context.Context, logger Logger, eventName string, errorMessage string, values ...string)

LogUnrecordedEvent logs the events that could not be reported in the DB

func MakeConfigurationDBModuleInstrumentingMW

func MakeConfigurationDBModuleInstrumentingMW(h cm.Histogram) func(ConfigurationDBModule) ConfigurationDBModule

MakeConfigurationDBModuleInstrumentingMW makes an instrumenting middleware at module level.

func NewKeycloakAuthClient

func NewKeycloakAuthClient(client KeycloakClient, logger Logger) security.KeycloakClient

NewKeycloakAuthClient creates an adaptor for Authorization management to access Keycloak

func NextDay

func NextDay(ref time.Time) time.Time

NextDay returns a time.Time value of the provided time rounded to the next month of the associated locale

func NextHour

func NextHour(ref time.Time) time.Time

NextHour returns a time.Time value of the provided time rounded to the next hour of the associated locale

func NextMonth

func NextMonth(ref time.Time) time.Time

NextMonth returns a time.Time value of the provided time rounded to the next month of the associated locale

func ThisMonth

func ThisMonth(ref time.Time) time.Time

ThisMonth returns a time.Time value of the provided time rounded to the beginning of the current month of the associated locale

func ToGoKitEndpoint

func ToGoKitEndpoint(e cs.Endpoint) endpoint.Endpoint

ToGoKitEndpoint converts endpoints

func Validate

func Validate(authorizations []dto.Authorization, allowedTargetRealmsAndGroupNames map[string]map[string]struct{}) error

Validate the content of the provided array. Returns an error if any issue is detected

Types

type ConfigurationDBModule

type ConfigurationDBModule interface {
	NewTransaction(context context.Context) (database.Transaction, error)
	StoreOrUpdate(context.Context, string, dto.RealmConfiguration) error
	GetConfiguration(context.Context, string) (dto.RealmConfiguration, error)
	GetAuthorizations(context context.Context, realmID string, groupName string) ([]dto.Authorization, error)
	CreateAuthorization(context context.Context, authz dto.Authorization) error
	DeleteAuthorizations(context context.Context, realmID string, groupName string) error
	DeleteAllAuthorizationsWithGroup(context context.Context, realmName, groupName string) error
}

ConfigurationDBModule is the interface of the configuration module.

func NewConfigurationDBModule

func NewConfigurationDBModule(db sqltypes.CloudtrustDB, logger log.Logger) ConfigurationDBModule

NewConfigurationDBModule returns a ConfigurationDB module.

type EventsDBModule

type EventsDBModule interface {
	GetEventsCount(context.Context, map[string]string) (int, error)
	GetEvents(context.Context, map[string]string) ([]api.AuditRepresentation, error)
	GetEventsSummary(context.Context) (api.EventSummaryRepresentation, error)
	GetLastConnection(context.Context, string) (int64, error)
	GetTotalConnectionsCount(context.Context, string, string) (int64, error)
	GetTotalConnectionsHoursCount(context.Context, string, *time.Location, int) ([][]int64, error)
	GetTotalConnectionsDaysCount(context.Context, string, *time.Location, int) ([][]int64, error)
	GetTotalConnectionsMonthsCount(context.Context, string, *time.Location, int) ([][]int64, error)
	GetLastConnections(context.Context, string, string) ([]api_stat.StatisticsConnectionRepresentation, error)
}

EventsDBModule is the interface of the audit events module.

func NewEventsDBModule

func NewEventsDBModule(db sqltypes.CloudtrustDB) EventsDBModule

NewEventsDBModule returns an events database module.

type KeycloakClient

type KeycloakClient interface {
	GetGroupsOfUser(accessToken string, realmName, userID string) ([]kc.GroupRepresentation, error)
	GetGroup(accessToken string, realmName, groupID string) (kc.GroupRepresentation, error)
}

KeycloakClient are methods from keycloak-client used by authorization manager

type Logger

type Logger interface {
	Debug(ctx context.Context, keyvals ...interface{}) error
	Info(ctx context.Context, keyvals ...interface{}) error
	Warn(ctx context.Context, keyvals ...interface{}) error
	Error(ctx context.Context, keyvals ...interface{}) error
}

Logger interface for logging with level

type Scanner

type Scanner interface {
	Scan(...interface{}) error
}

Scanner used to get data from SQL cursors

Jump to

Keyboard shortcuts

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