pkg

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const TransmitterConfigMetadataPath = "/.well-known/ssf-configuration"
View Source
const TransmitterPollRFC = "urn:ietf:rfc:8936"
View Source
const TransmitterPushRFC = "urn:ietf:rfc:8935"

Variables

View Source
var EnumToStringStatusMap = map[StreamStatus]string{
	StreamEnabled:  "enabled",
	StreamPaused:   "paused",
	StreamDisabled: "disabled",
}
View Source
var StatusEnumMap = map[string]StreamStatus{
	"enabled":  StreamEnabled,
	"paused":   StreamPaused,
	"disabled": StreamDisabled,
}

Functions

This section is empty.

Types

type CreateStreamReq

type CreateStreamReq struct {
	Delivery        SsfDelivery `json:"delivery"`
	EventsRequested []string    `json:"events_requested"`
	Description     string      `json:"description,omitempty"`
}

Struct used to make a Create Stream request for the receiver

type EventSet added in v0.5.4

type EventSet struct {
}

type PollTransmitterRequest

type PollTransmitterRequest struct {
	Acknowledgements  []string `json:"ack"`
	MaxEvents         int      `json:"maxEvents,omitempty"`
	ReturnImmediately bool     `json:"returnImmediately"`
}

Struct to make a request to poll SSF Events to the configured transmitter

type ReceiverConfig

type ReceiverConfig struct {
	// TransmitterUrl defines the URL for the transmitter that
	// the configured receiver will create a stream with and receive
	// events from.
	//
	// Required
	TransmitterUrl string

	// TransmitterTypeRfc defines whether this receiver is push or pull
	//
	//
	// Required
	TransmitterTypeRfc string

	// TransmitterPollUrl defines the URL that the receiver will use
	// to poll for SSF events.
	//
	// Note - Must be a subpath of TransmitterUrl
	//
	// Required
	TransmitterPollUrl string

	// TransmitterPushUrl defines the URL that the receiver will use
	// to received push events
	//
	// Note - Must be a subpath of TransmitterUrl
	//
	// Required
	TransmitterPushUrl string

	// TransmitterStreamUrl defines the URL that the receiver will use
	// to update/get the stream status.
	//
	// Note - Must be a subpath of TransmitterUrl
	//
	// Optional
	TransmitterStreamUrl string

	// EventsRequested specified the SSF events you want to receiver
	// from the transmitter.
	//
	// Required
	EventsRequested []events.EventType

	// AuthorizationToken is the authorization token used to authorize
	// your receiver with the specified transmitter
	//
	// Note - all transmitter's will require an authorization token
	//
	// Required
	AuthorizationToken string

	// PollCallback is used to configure the method that you want the
	// receiver to call after each automatic poll request. Each time
	// the poll interval timer is up, the receiver will make a request
	// to the specified transmitter and fetch available SSF events. It
	// will then call PollCallback with a list of those events
	//
	// Note - The PollCallback and PollInterval can also be configured
	// after initial receiver construction
	//
	// Optional
	PollCallback func(events []events.SsfEvent)

	// PollInterval defines, in seconds how often you want the receiver to
	// poll for SSF events any and pass them to your PollCallback function.
	//
	// Note - This field will not be used if the PollCallback isn't configured
	//
	// Optional, defaults to 300 (5 minutes)
	PollInterval int
}

type SETCredentialChange added in v0.5.9

type SETCredentialChange struct {
	SubID  SubId `json:"sub_id"`
	Events struct {
		Event struct {
			EventTimestamp int64  `json:"event_timestamp"`
			Reason         string `json:"reason,omitempty"`
			CredentialType string `json:"credential_type"`
			ChangeType     string `json:"change_type"`
		} `json:"https://schemas.openid.net/secevent/caep/event-type/credential-change"`
	} `json:"events"`

	jwt.StandardClaims
}

type SETSessionRevoked added in v0.5.1

type SETSessionRevoked struct {
	SubID  SubId `json:"sub_id"`
	Events struct {
		Event struct {
			EventTimestamp int64  `json:"event_timestamp"`
			Reason         string `json:"reason,omitempty"`
		} `json:"https://schemas.openid.net/secevent/caep/event-type/session-revoked"`
	} `json:"events"`

	jwt.StandardClaims
}

type SsfDelivery

type SsfDelivery struct {
	DeliveryMethod string `json:"method"`
	EndpointUrl    string `json:"endpoint_url,omitempty"`
}

Struct that defines the deliver method for the Create Stream Request

type SsfReceiver

type SsfReceiver interface {
	ConfigureCallback(callback func(events []event.SsfEvent), pollInterval int) error

	// Polls the configured receiver a returns a list of the available SSF
	// Events
	PollEvents() ([]event.SsfEvent, error)

	// Cleans up the Receiver's resources and deletes it from the transmitter
	DeleteReceiver()

	// Get stream status from the transmitter
	GetStreamStatus() (StreamStatus, error)

	// Enable the stream
	EnableStream() (StreamStatus, error)

	// Pause the stream
	PauseStream() (StreamStatus, error)

	// Disable the stream
	DisableStream() (StreamStatus, error)

	// Disable the stream
	PrintStream()
}

Represents the interface for the SSF receiver with user facing methods

func ConfigureSsfReceiver

func ConfigureSsfReceiver(cfg ReceiverConfig, streamId string) (SsfReceiver, error)

Initializes the SSF Receiver based on the specified configuration.

Returns an error if any process of configuring the receiver, registering it with the transmitter, or setting up the poll interval failed

type SsfReceiverImplementation

type SsfReceiverImplementation struct {
	// contains filtered or unexported fields
}

The struct that contains all the necessary fields and methods for the SSF Receiver's implementation

func (*SsfReceiverImplementation) ConfigureCallback

func (receiver *SsfReceiverImplementation) ConfigureCallback(callback func(events []events.SsfEvent), pollInterval int) error

TODO: Not Yet Implemented

func (*SsfReceiverImplementation) DeleteReceiver

func (receiver *SsfReceiverImplementation) DeleteReceiver()

Cleans up the resources used by the Receiver and deletes the Receiver's stream from the transmitter

func (*SsfReceiverImplementation) DisableStream

func (receiver *SsfReceiverImplementation) DisableStream() (StreamStatus, error)

func (*SsfReceiverImplementation) EnableStream

func (receiver *SsfReceiverImplementation) EnableStream() (StreamStatus, error)

func (*SsfReceiverImplementation) GetStreamStatus

func (receiver *SsfReceiverImplementation) GetStreamStatus() (StreamStatus, error)

func (*SsfReceiverImplementation) InitPollInterval

func (receiver *SsfReceiverImplementation) InitPollInterval()

Initializes the poll interval for the receiver that will intermittently send SSF Events to the specified callback function

func (*SsfReceiverImplementation) PauseStream

func (receiver *SsfReceiverImplementation) PauseStream() (StreamStatus, error)

func (*SsfReceiverImplementation) PollEvents

func (receiver *SsfReceiverImplementation) PollEvents() ([]events.SsfEvent, error)

Polls the transmitter for all available SSF Events, returning them as a list for use

func (*SsfReceiverImplementation) PrintStream added in v0.5.2

func (receiver *SsfReceiverImplementation) PrintStream()

type StreamConfig added in v0.5.1

type StreamConfig struct {
	StreamId        string      `json:"stream_id"`
	Issuer          string      `json:"iss"`
	Audience        string      `json:"aud"`
	EventsSupported []string    `json:"events_supported"`
	EventsRequested []string    `json:"events_requested"`
	EventsDelivered []string    `json:"events_delivered"`
	Delivery        SsfDelivery `json:"delivery"`
	Description     string      `json:"description,omitempty"`
}

type StreamStatus

type StreamStatus int
const (
	StreamEnabled StreamStatus = iota + 1
	StreamPaused
	StreamDisabled
)

type StreamSubjectRequest added in v0.5.4

type StreamSubjectRequest struct {
	StreamID string `json:"stream_id,omitempty"`
	Subject  SubId  `json:"subject,omitempty"`
	Verified bool   `json:"verified,omitempty"`
}

Struct to make subject changes to a stream

type SubId added in v0.5.1

type SubId struct {
	Format string `json:"format"`
	Email  string `json:"email"`
}

type TransmitterConfig

type TransmitterConfig struct {
	Issuer                   string                   `json:"issuer"`
	JwksUri                  string                   `json:"jwks_uri,omitempty"`
	DeliveryMethodsSupported []string                 `json:"delivery_methods_supported,omitempty"`
	ConfigurationEndpoint    string                   `json:"configuration_endpoint,omitempty"`
	StatusEndpoint           string                   `json:"status_endpoint,omitempty"`
	AddSubjectEndpoint       string                   `json:"add_subject_endpoint,omitempty"`
	RemoveSubjectEndpoint    string                   `json:"remove_subject_endpoint,omitempty"`
	SpecVersion              string                   `json:"spec_version,omitempty"`
	AuthorizationSchemes     []map[string]interface{} `json:"authorization_schemes,omitempty"`
}

Struct used to read a Transmitter's configuration

type UpdateStreamRequest

type UpdateStreamRequest struct {
	StreamId string `json:"stream_id"`
	Status   string `json:"status"`
	Reason   string `json:"reason"`
}

Struct to make a request to update the stream status

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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