Documentation
¶
Overview ¶
Package login implements the login.example microservice.
The Login microservice demonstrates usage of authentication and authorization.
Index ¶
- Constants
- type Actor
- type Mock
- type Service
- func (svc *Service) AdminOnly(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Service) Init(initializer func(svc *Service)) *Service
- func (svc *Service) Login(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Service) Logout(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Service) ManagerOnly(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Service) OnShutdown(ctx context.Context) (err error)
- func (svc *Service) OnStartup(ctx context.Context) (err error)
- func (svc *Service) Welcome(w http.ResponseWriter, r *http.Request) (err error)
Constants ¶
const Hostname = "login.example"
Hostname is the default hostname of the microservice: login.example.
const SourceCodeSHA256 = "b609c37edce424a78a640347ce981ce5b77543ef955eb64fb2ae594ef3ecace1"
const Timestamp = "2025-07-12T16:29:56.036449Z"
const Version = 66
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actor ¶
Actor represents the authenticated user. It is parsed from the claims associated with the request.
func (*Actor) SetManager ¶
func (a *Actor) SetManager()
SetManager claims the manager role for the actor.
type Mock ¶
type Mock = intermediate.Mock
Mock is a mockable version of the login.example microservice, allowing functions, event sinks and web handlers to be mocked.
type Service ¶
type Service struct {
*intermediate.Intermediate // DO NOT REMOVE
}
Service implements the login.example microservice.
The Login microservice demonstrates usage of authentication and authorization.
func (*Service) Init ¶
Init enables a single-statement pattern for initializing the microservice.
svc.Init(func(svc Service) {
svc.SetGreeting("Hello")
})
func (*Service) Login ¶
Login renders a simple login screen that authenticates a user. Known users are hardcoded as "admin", "manager" and "user". The password is "password".
func (*Service) ManagerOnly ¶
ManagerOnly is only accessible by managers.
func (*Service) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
Directories
¶
| Path | Synopsis |
|---|---|
|
app
|
|
|
login
command
|
|
|
Package intermediate serves as the foundation of the login.example microservice.
|
Package intermediate serves as the foundation of the login.example microservice. |
|
Package loginapi implements the public API of the login.example microservice, including clients and data structures.
|
Package loginapi implements the public API of the login.example microservice, including clients and data structures. |