fakecookies

package
v0.0.0-...-053b097 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFakeCookiesSession

func IsFakeCookiesSession(s auth.Session) bool

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

func (m *AuthMethod) LoginURL(ctx context.Context, dest string) (string, error)

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

func (m *AuthMethod) LogoutURL(ctx context.Context, dest string) (string, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL