Documentation
¶
Index ¶
- Variables
- type GenericRestService
- type JsonWebTokenRestService
- func (restService *JsonWebTokenRestService) CreateSession(w http.ResponseWriter, r *http.Request) (service.Session, error)
- func (restService *JsonWebTokenRestService) GenerateToken(w http.ResponseWriter, req *http.Request)
- func (restService *JsonWebTokenRestService) RefreshToken(w http.ResponseWriter, r *http.Request)
- func (restService *JsonWebTokenRestService) Verify(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
- type JsonWebTokenServicer
- type RestRegistry
- type RestService
- type RestServiceRegistry
- type SystemRestService
- func (restService *SystemRestService) Certificate(w http.ResponseWriter, r *http.Request)
- func (restService *SystemRestService) Config(w http.ResponseWriter, r *http.Request)
- func (restService *SystemRestService) Endpoints(w http.ResponseWriter, r *http.Request)
- func (restService *SystemRestService) EventsPage(w http.ResponseWriter, r *http.Request)
- func (restService *SystemRestService) PublicKey(w http.ResponseWriter, r *http.Request)
- func (restService *SystemRestService) Status(w http.ResponseWriter, r *http.Request)
- type SystemRestServicer
Constants ¶
This section is empty.
Variables ¶
var ( ErrAuthorizationHeaderRequired = errors.New("authorization header required") ErrInvalidToken = errors.New("invalid token") ErrInvalidUserClaim = errors.New("invalid user id claim") ErrInvalidEmailClaim = errors.New("invalid email claim") )
var (
ErrInvalidOrganiztionID = errors.New("rest/jwt: invalid organization id")
)
Functions ¶
This section is empty.
Types ¶
type GenericRestService ¶
type GenericRestService[E any] struct { SystemRestService // contains filtered or unexported fields }
type JsonWebTokenRestService ¶
type JsonWebTokenRestService struct {
JsonWebTokenServicer
// contains filtered or unexported fields
}
func (*JsonWebTokenRestService) CreateSession ¶
func (restService *JsonWebTokenRestService) CreateSession( w http.ResponseWriter, r *http.Request) (service.Session, error)
Creates a new web service session from the parsed JWT
func (*JsonWebTokenRestService) GenerateToken ¶
func (restService *JsonWebTokenRestService) GenerateToken(w http.ResponseWriter, req *http.Request)
Decodes the requst body to a service.UserCredentials structure and generates a new JWT using the unmarshalled username and password.
func (*JsonWebTokenRestService) RefreshToken ¶
func (restService *JsonWebTokenRestService) RefreshToken(w http.ResponseWriter, r *http.Request)
Exchange a JWT for a new token with a new expiration date
func (*JsonWebTokenRestService) Verify ¶
func (restService *JsonWebTokenRestService) Verify( w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
Validates the raw JWT token to ensure it's not expired or contains invalid claims. This is used by the negroni middleware to enforce authenticated access to procted resources.
type JsonWebTokenServicer ¶
type JsonWebTokenServicer interface {
middleware.JsonWebTokenMiddleware
}
func NewJsonWebTokenRestService ¶
func NewJsonWebTokenRestService( logger *logging.Logger, responseWriter response.HttpWriter, service *jwt.Service) (JsonWebTokenServicer, error)
Instantiate a new JsonWebTokenService
type RestRegistry ¶
type RestRegistry struct {
RestServiceRegistry
// contains filtered or unexported fields
}
func (*RestRegistry) JsonWebTokenService ¶
func (registry *RestRegistry) JsonWebTokenService() JsonWebTokenServicer
func (*RestRegistry) SystemRestService ¶
func (registry *RestRegistry) SystemRestService() SystemRestServicer
type RestService ¶
type RestServiceRegistry ¶
type RestServiceRegistry interface {
JsonWebTokenService() JsonWebTokenServicer
SystemRestService() SystemRestServicer
}
func NewRestServiceRegistry ¶
func NewRestServiceRegistry( logger *logging.Logger, ca ca.CertificateAuthority, serverKeyAttributes *keystore.KeyAttributes, config *config.WebService, jwtClaimsIssuer string) RestServiceRegistry
type SystemRestService ¶
type SystemRestService struct {
SystemRestServicer
// contains filtered or unexported fields
}
func (*SystemRestService) Certificate ¶
func (restService *SystemRestService) Certificate(w http.ResponseWriter, r *http.Request)
Writes the web server x509 certificate in PEM form
func (*SystemRestService) Config ¶
func (restService *SystemRestService) Config(w http.ResponseWriter, r *http.Request)
Writes the application configuration
func (*SystemRestService) Endpoints ¶
func (restService *SystemRestService) Endpoints(w http.ResponseWriter, r *http.Request)
Writes a list of webservice REST and WebSocket endpoints
func (*SystemRestService) EventsPage ¶
func (restService *SystemRestService) EventsPage(w http.ResponseWriter, r *http.Request)
Writes a page of system event log entries
func (*SystemRestService) PublicKey ¶
func (restService *SystemRestService) PublicKey(w http.ResponseWriter, r *http.Request)
Writes the web server public key in PEM form
func (*SystemRestService) Status ¶
func (restService *SystemRestService) Status(w http.ResponseWriter, r *http.Request)
Writes the current system status and metrics
type SystemRestServicer ¶
type SystemRestServicer interface {
Config(w http.ResponseWriter, r *http.Request)
Certificate(w http.ResponseWriter, r *http.Request)
Endpoints(w http.ResponseWriter, r *http.Request)
EventsPage(w http.ResponseWriter, r *http.Request)
PublicKey(w http.ResponseWriter, r *http.Request)
Status(w http.ResponseWriter, r *http.Request)
}
func NewSystemRestService ¶
func NewSystemRestService( ca ca.CertificateAuthority, serverKeyAttributes *keystore.KeyAttributes, httpWriter response.HttpWriter, logger *logging.Logger, endpointList *[]string) SystemRestServicer