Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateInitialCode(nbUpperCase int, nbDigits int, nbLowerCase int) string
- func GeneratePassword(policy *string, minLength int, userID string) (string, error)
- func GeneratePasswordFromKeycloakPolicy(policy string) (string, error)
- func GeneratePasswordNoKeycloakPolicy(minLength int) string
- func LimitRate(e cs.Endpoint, limit int) endpoint.Endpoint
- func MakeConfigurationDBModuleInstrumentingMW(h cm.Histogram) func(ConfigurationDBModule) ConfigurationDBModule
- func NewConfigurationDBModule(db DBConfiguration) *configurationDBModule
- func NewKeycloakAuthClient(client KeycloakClient, logger Logger) security.KeycloakClient
- func ToGoKitEndpoint(e cs.Endpoint) endpoint.Endpoint
- type ConfigurationDBModule
- type DBConfiguration
- type EventsDBModule
- type KeycloakClient
- type Logger
- type MissingRealmConfigurationErr
Constants ¶
const ( MsgErrInvalidParam = "invalidParameter" MsgErrMissingParam = "missingParameter" MsgErrWrongTypeRequest = "wrongTypeRequest" MsgErrInvalidJSONRequest = "invalidJSONRequest" MsgErrInvalidBase64Object = "invalidBase64Object" MsgErrInvalidLength = "invalidLength" MsgErrCannotObtain = "cannotObtain" MsgErrCannotMarshal = "cannotMarshal" MsgErrCannotSaveConfigInDB = "cannotSaveConfigInDB" MsgErrCannotUpdate = "cannotUpdate" MsgErrUnknown = "unknowError" CurrentPassword = "currentPassword" NewPassword = "newPassword" ConfirmPassword = "confirmPassword" Password = "password" Type = "type" ID = "id" Label = "label" UserID = "userId" Username = "username" User = "user" Email = "email" Firstname = "firstname" Lastname = "lastname" PhoneNumber = "phoneNumber" Gender = "gender" Birthdate = "birthdate" GroudID = "groupId" GroudIDs = "groupIds" RoleID = "roleId" Locale = "locale" Description = "description" ContainerID = "containerId" DefaultClientID = "defaultClientId" DefaultRedirectURI = "defaultRedirectURI" RequiredAction = "requiredAction" DurationLabel = "durationLabel" Body = "body" Flatbuffer = "flatbuffer" Realm = "realm" KeycloakRealms = "keycloakRealms" Config = "config" Response = "response" ListOfRealms = "listOfRealms" Groups = "groups" ClientID = "clientId" RedirectURI = "redirectURI" Exclude = "exclude" )
Normalized error messages
Variables ¶
var ( // ComponentName is the name of the component. ComponentName = "keycloak-bridge" // Version of the component. Version = "1.1" )
Functions ¶
func GenerateInitialCode ¶
GenerateInitialCode generates a code of the format UpperCase + digits + LowerCase
func GeneratePassword ¶
GeneratePassword generates a password accoring to the policy or minimum length imposed
func GeneratePasswordFromKeycloakPolicy ¶
GeneratePasswordFromKeycloakPolicy generates a random password respecting the keycloak password policy
func GeneratePasswordNoKeycloakPolicy ¶
GeneratePasswordNoKeycloakPolicy generates a password of a given length
func MakeConfigurationDBModuleInstrumentingMW ¶
func MakeConfigurationDBModuleInstrumentingMW(h cm.Histogram) func(ConfigurationDBModule) ConfigurationDBModule
MakeConfigurationDBModuleInstrumentingMW makes an instrumenting middleware at module level.
func NewConfigurationDBModule ¶
func NewConfigurationDBModule(db DBConfiguration) *configurationDBModule
NewConfigurationDBModule returns a ConfigurationDB module.
func NewKeycloakAuthClient ¶
func NewKeycloakAuthClient(client KeycloakClient, logger Logger) security.KeycloakClient
NewKeycloakAuthClient creates an adaptor for Authorization management to access Keycloak
Types ¶
type ConfigurationDBModule ¶
type ConfigurationDBModule interface { StoreOrUpdate(context.Context, string, dto.RealmConfiguration) error GetConfiguration(context.Context, string) (dto.RealmConfiguration, error) }
ConfigurationDBModule is the interface of the configuration module.
type DBConfiguration ¶
type DBConfiguration interface { Exec(query string, args ...interface{}) (sql.Result, error) QueryRow(query string, args ...interface{}) *sql.Row }
DBConfiguration interface
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) }
EventsDBModule is the interface of the audit events module.
func NewEventsDBModule ¶
func NewEventsDBModule(db database.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(keyvals ...interface{}) error Info(keyvals ...interface{}) error Warn(keyvals ...interface{}) error Error(keyvals ...interface{}) error }
Logger interface for logging with level
type MissingRealmConfigurationErr ¶
type MissingRealmConfigurationErr struct {
// contains filtered or unexported fields
}
MissingRealmConfigurationErr is the error thrown if no configuration is found in DB
func (MissingRealmConfigurationErr) Error ¶
func (e MissingRealmConfigurationErr) Error() string