communications

package
v3.22.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: GPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	COMGetActions = newAction("COM_GetActions", security.ScopeRealm)
	COMSendEmail  = newAction("COM_SendEmail", security.ScopeRealm)
	COMSendSMS    = newAction("COM_SendSMS", security.ScopeRealm)
)

Creates constants for API method names

Functions

func GetActions

func GetActions() []security.Action

GetActions returns available actions

func MakeAuthorizationCommunicationsComponentMW

func MakeAuthorizationCommunicationsComponentMW(logger log.Logger, authorizationManager security.AuthorizationManager) func(Component) Component

MakeAuthorizationCommunicationsComponentMW checks authorization and return an error if the action is not allowed.

func MakeCommunicationsHandler

func MakeCommunicationsHandler(e endpoint.Endpoint, logger log.Logger) *http_transport.Server

MakeCommunicationsHandler make an HTTP handler for a Communications endpoint.

func MakeGetActionsEndpoint

func MakeGetActionsEndpoint(component Component) cs.Endpoint

MakeGetActionsEndpoint creates an endpoint for GetActions

func MakeSendEmailEndpoint

func MakeSendEmailEndpoint(component Component) cs.Endpoint

MakeSendEmailEndpoint makes the SendEmail Endpoint

func MakeSendSMSEndpoint

func MakeSendSMSEndpoint(component Component) cs.Endpoint

MakeSendSMSEndpoint makes the SendSMS Endpoint

Types

type Component

type Component interface {
	GetActions(ctx context.Context) ([]api.ActionRepresentation, error)

	SendEmail(ctx context.Context, realmName string, emailRep api.EmailRepresentation) error
	SendSMS(ctx context.Context, realmName string, smsRep api.SMSRepresentation) error
}

Component interface exposes methods used by the bridge API

func NewComponent

func NewComponent(keycloakCommunicationsClient KeycloakCommunicationsClient, logger internal.Logger) Component

NewComponent returns the communications component.

type Endpoints

type Endpoints struct {
	GetActions endpoint.Endpoint
	SendEmail  endpoint.Endpoint
	SendSMS    endpoint.Endpoint
}

Endpoints wraps a service behind a set of endpoints.

type KeycloakCommunicationsClient

type KeycloakCommunicationsClient interface {
	SendEmail(accessToken string, reqRealmName string, realmName string, emailRep kc.EmailRepresentation) error
	SendSMS(accessToken string, realmName string, smsRep kc.SMSRepresentation) error
}

KeycloakCommunicationsClient interface exposes methods we need to call to send requests to Keycloak communications API

Jump to

Keyboard shortcuts

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