Documentation ¶
Overview ¶
Package fakecookies implements a cookie-based fake authentication method.
It is used during the development instead of real encrypted cookies. It is absolutely insecure and must not be used in any real server.
Index ¶
- func IsFakeCookiesSession(s auth.Session) bool
- type AuthMethod
- func (m *AuthMethod) Authenticate(ctx context.Context, r auth.RequestMetadata) (*auth.User, auth.Session, error)
- func (m *AuthMethod) InstallHandlers(r *router.Router, base router.MiddlewareChain)
- func (m *AuthMethod) LoginURL(ctx context.Context, dest string) (string, error)
- func (m *AuthMethod) LogoutURL(ctx context.Context, dest string) (string, error)
- func (m *AuthMethod) StateEndpointURL(ctx context.Context) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsFakeCookiesSession ¶
IsFakeCookiesSession returns true if the given auth.Session was produced by a fake cookies auth method.
Types ¶
type AuthMethod ¶
type AuthMethod struct { // LimitCookieExposure, if set, makes the fake cookie behave the same way as // when this option is used with production cookies. // // See the module documentation. LimitCookieExposure bool // ExposedStateEndpoint is a URL path of the state endpoint, if any. ExposedStateEndpoint string // contains filtered or unexported fields }
AuthMethod is an auth.Method implementation that uses fake cookies.
func (*AuthMethod) Authenticate ¶
func (m *AuthMethod) Authenticate(ctx context.Context, r auth.RequestMetadata) (*auth.User, auth.Session, error)
Authenticate authenticates the request.
Implements auth.Method.
func (*AuthMethod) InstallHandlers ¶
func (m *AuthMethod) InstallHandlers(r *router.Router, base router.MiddlewareChain)
InstallHandlers installs HTTP handlers used in the login protocol.
Implements auth.HasHandlers.
func (*AuthMethod) LoginURL ¶
LoginURL returns a URL that, when visited, prompts the user to sign in, then redirects the user to the URL specified by dest.
Implements auth.UsersAPI.
func (*AuthMethod) LogoutURL ¶
LogoutURL returns a URL that, when visited, signs the user out, then redirects the user to the URL specified by dest.
Implements auth.UsersAPI.
func (*AuthMethod) StateEndpointURL ¶
func (m *AuthMethod) StateEndpointURL(ctx context.Context) (string, error)
StateEndpointURL returns an URL that serves the authentication state.
Implements auth.HasStateEndpoint.