Documentation ¶
Index ¶
- type Handler
- func (h *Handler) AddUser(u *User)
- func (h *Handler) ExcludeExtensions()
- func (h *Handler) Login(_ http.ResponseWriter, _ *http.Request, lr *openid2.LoginRequest) (*openid2.LoginResponse, error)
- func (h *Handler) Reset()
- func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SetLoginUser(user string)
- type Server
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is a http.Handler that provides a mock implementation of Ubuntu SSO. It is designed to closely match the responses provided by Ubuntu SSO providing openid login and oauth verification.
func (*Handler) ExcludeExtensions ¶
func (h *Handler) ExcludeExtensions()
ExcludeExtensions prevents an OpenID login response from including any extensions.
func (*Handler) Login ¶
func (h *Handler) Login(_ http.ResponseWriter, _ *http.Request, lr *openid2.LoginRequest) (*openid2.LoginResponse, error)
Login handles OpenID login requests.
func (*Handler) Reset ¶
func (h *Handler) Reset()
Reset sets all of the state in the Handler back to the default. This should be called between tests.
func (*Handler) SetLoginUser ¶
SetLoginUser sets the user that is logged in when an OpenID request is recieved.
type Server ¶
type Server struct { MockUSSO *Handler // contains filtered or unexported fields }
Server represents a mock USSO server.
func NewServer ¶
func NewServer() *Server
NewServer starts a mock USSO server and also modifies http.DefaultTransport to redirect requests addressed to https://login.ubuntu.com to it.
The returned Server must be closed after use.