server

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

README

Go API Server for swagger

OpenID Spec HTTP API to be implemented by Event Transmitters. This API can be used by Event Receivers to query and update the Event Stream configuration and status, to add and remove subjects, and to trigger verification.

Overview

This server was generated by the [swagger-codegen] (https://github.com/swagger-api/swagger-codegen) project.
By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.

To see how to make this your own, look here:

README

  • API version: 1.0.0
  • Build date: 2022-08-09T12:07:15.591775-07:00[America/Vancouver]
Running the server

To run the server, follow these simple steps:

go run main.go

Documentation

Overview

Package server - Stream Management API for OpenID Shared Security Events [OpenID Spec](https://openid.net/specs/openid-sse-framework-1_0.html#management) HTTP API to be implemented by Event Transmitters. This API can be used by Event Receivers to query and update the Event Stream configuration and status, to add and remove subjects, and to trigger verification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrometheusHttpMiddleware

func PrometheusHttpMiddleware(next http.Handler) http.Handler

Types

type ClientPollStream

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

func (*ClientPollStream) Close

func (ps *ClientPollStream) Close()

type HttpRouter

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

func NewRouter

func NewRouter(application *SignalsApplication) *HttpRouter

type PrometheusHandler

type PrometheusHandler struct {
	App                    *SignalsApplication
	EventsIn, EventsOut    *prometheus.CounterVec
	PubPushCnt, PubPollCnt prometheus.GaugeFunc
	RcvPushCnt, RcvPollCnt prometheus.GaugeFunc
}

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
	IsIdQuery   bool
}

type Routes

type Routes []Route

type SignalsApplication

type SignalsApplication struct {
	Provider    dbProviders.DbProviderInterface
	Server      *http.Server
	EventRouter eventRouter.EventRouter
	BaseUrl     *url.URL
	HostName    string
	DefIssuer   string
	AdminRole   string
	AdminUser   string
	AdminPwd    string
	Auth        *authUtil.AuthIssuer

	Stats *PrometheusHandler
	// contains filtered or unexported fields
}

func StartServer

func StartServer(addr string, provider dbProviders.DbProviderInterface, baseUrlString string) *SignalsApplication

func (*SignalsApplication) AddSubject

func (sa *SignalsApplication) AddSubject(w http.ResponseWriter, _ *http.Request)

func (*SignalsApplication) ClosePollReceiver

func (sa *SignalsApplication) ClosePollReceiver(sid string)

func (*SignalsApplication) CreateJwksIssuer

func (sa *SignalsApplication) CreateJwksIssuer(w http.ResponseWriter, r *http.Request)

func (*SignalsApplication) GetPollReceiverCnt

func (sa *SignalsApplication) GetPollReceiverCnt() float64

func (*SignalsApplication) GetPushReceiverCnt

func (sa *SignalsApplication) GetPushReceiverCnt() float64

func (*SignalsApplication) GetStatus

func (sa *SignalsApplication) GetStatus(w http.ResponseWriter, r *http.Request)

func (*SignalsApplication) HandleClientPollReceiver

func (sa *SignalsApplication) HandleClientPollReceiver(streamState *model.StreamStateRecord) *ClientPollStream

HandleClientPollReceiver checks if a stream is already defined and updates the configuration returning the ClientPollStream. Otherwise, if new, a new receiver is started and its handle is returned. Transmitter streams are ignored automatically.

func (*SignalsApplication) HealthCheck

func (sa *SignalsApplication) HealthCheck() bool

func (*SignalsApplication) Index

func (*SignalsApplication) InitializePrometheus

func (sa *SignalsApplication) InitializePrometheus()

func (*SignalsApplication) InitializeReceivers

func (sa *SignalsApplication) InitializeReceivers()

InitializeReceivers handles updates to a receiver client polling stream when changes occur.

func (*SignalsApplication) IssuerProjectIat

func (sa *SignalsApplication) IssuerProjectIat(w http.ResponseWriter, r *http.Request)

IssuerProjectIat generates an Initial Access Auth (IAT) which can be used at the registration endpoint. The token generated will have a unique projectId and scope of `register` that will allow individual clients to register and access the stream management functions of the server for a particular project. If an existing authorization is provided with scope authUtil.ScopeStreamAdmin, then the existing ProjectId is used. This allows the creation of "fresh" IATs which can be used to register new clients in the same project (e.g. because the current IAT is expired, or because separate IATs are desired.

func (*SignalsApplication) JwksJson

func (sa *SignalsApplication) JwksJson(w http.ResponseWriter, _ *http.Request)

func (*SignalsApplication) JwksJsonIssuer

func (sa *SignalsApplication) JwksJsonIssuer(w http.ResponseWriter, r *http.Request)

func (*SignalsApplication) Logger

func (sa *SignalsApplication) Logger(inner http.Handler, name string) http.Handler

func (*SignalsApplication) Name

func (sa *SignalsApplication) Name() string

func (*SignalsApplication) PollEvents

func (sa *SignalsApplication) PollEvents(w http.ResponseWriter, r *http.Request)

PollEvents implements the server side of RFC8936 Poll-based delivery of SET Tokens

func (*SignalsApplication) ReceivePushEvent

func (sa *SignalsApplication) ReceivePushEvent(w http.ResponseWriter, r *http.Request)

ReceivePushEvent events enables an endpoint to receive events from the RFC8935 SET Push provider

func (*SignalsApplication) RegisterClient

func (sa *SignalsApplication) RegisterClient(w http.ResponseWriter, r *http.Request)

RegisterClient handles initial SSF client registrations and issues tokens enabling stream management. In order to access the registration endpoint an initial access token with scope 'register' is required. If 'root' scope is provided, a registration token is issued which can be used to start the client registration process.

func (*SignalsApplication) RemoveSubject

func (sa *SignalsApplication) RemoveSubject(w http.ResponseWriter, _ *http.Request)

func (*SignalsApplication) Shutdown

func (sa *SignalsApplication) Shutdown()

func (*SignalsApplication) StreamCreate

func (sa *SignalsApplication) StreamCreate(w http.ResponseWriter, r *http.Request)

func (*SignalsApplication) StreamDelete

func (sa *SignalsApplication) StreamDelete(w http.ResponseWriter, r *http.Request)

func (*SignalsApplication) StreamGet

func (sa *SignalsApplication) StreamGet(w http.ResponseWriter, r *http.Request)

func (*SignalsApplication) StreamUpdate

func (sa *SignalsApplication) StreamUpdate(w http.ResponseWriter, r *http.Request)

func (*SignalsApplication) TriggerEvent

func (sa *SignalsApplication) TriggerEvent(w http.ResponseWriter, _ *http.Request)

func (*SignalsApplication) UpdateStatus

func (sa *SignalsApplication) UpdateStatus(w http.ResponseWriter, r *http.Request)

func (*SignalsApplication) VerificationRequest

func (sa *SignalsApplication) VerificationRequest(w http.ResponseWriter, _ *http.Request)

func (*SignalsApplication) WellKnownSsfConfigurationGet

func (sa *SignalsApplication) WellKnownSsfConfigurationGet(w http.ResponseWriter, _ *http.Request)

func (*SignalsApplication) WellKnownSsfConfigurationIssuerGet

func (sa *SignalsApplication) WellKnownSsfConfigurationIssuerGet(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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