Documentation
¶
Index ¶
- Variables
- type Handler
- func (h *Handler) Authenticate(ctx context.Context, req *connect.Request[authnv1.AuthenticateRequest]) (*connect.Response[authnv1.AuthenticateResponse], error)
- func (h *Handler) Login(ctx context.Context, req *connect.Request[authnv1.LoginRequest]) (*connect.Response[authnv1.LoginResponse], error)
- func (h *Handler) Register(mux *http.ServeMux, opts []connect.HandlerOption)
- type Issuer
- type Parser
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnauthenticated = newError(connect.CodeUnauthenticated, "missing or invalid authentication") ErrInternal = newError(connect.CodeInternal, "internal error") )
Common errors to be returned by handler methods.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements the AuthnService RPC.
func (*Handler) Authenticate ¶
func (h *Handler) Authenticate( ctx context.Context, req *connect.Request[authnv1.AuthenticateRequest], ) (*connect.Response[authnv1.AuthenticateResponse], error)
Authenticate validates the given token and returns a subset of the claims for use in other logic.
func (*Handler) Login ¶
func (h *Handler) Login( ctx context.Context, req *connect.Request[authnv1.LoginRequest], ) (*connect.Response[authnv1.LoginResponse], error)
Login returns a JWT for the ID in the request.
No validation of the caller's identity is performed, nor whether the given secret is in any way valid. While this is normally indefensible, this method exists only as a means to experiment with authorization implementations, and is thus acceptable.
In a production environment, this would likely involve checking the identity exists in a database. Additionally, validation that the secret is acceptable for that identity would be performed.