authtest

package
v0.12.6 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package authtest provides helper functionality for testing authentication with Quarterdeck as simply as possible. This package focuses primarily on the issuance and verification of JWT tokens rather than on providing mocking behavior the whole API.

Index

Constants

View Source
const (
	Audience = "http://127.0.0.1"
	Issuer   = "http://127.0.0.1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	URL *url.URL
	// contains filtered or unexported fields
}

Server implements an endpoint to host JWKS public keys and also provides simple functionality to create access and refresh tokens that would be authenticated.

func NewServer

func NewServer() (s *Server, err error)

NewServer starts and returns a new authtest server. The caller should call Close when finished, to shut it down.

func (*Server) Close

func (s *Server) Close()

func (*Server) CreateAccessToken

func (s *Server) CreateAccessToken(claims *tokens.Claims) (tks string, err error)

func (*Server) CreateToken added in v0.10.0

func (s *Server) CreateToken(claims *tokens.Claims) (tks string, err error)

CreateToken creates a token without overwriting the claims, which is useful for creating tokens with specific not before and expiration times for testing.

func (*Server) CreateTokenPair added in v0.5.2

func (s *Server) CreateTokenPair(claims *tokens.Claims) (accessToken, refreshToken string, err error)

func (*Server) JWKS

func (s *Server) JWKS(w http.ResponseWriter, r *http.Request)

func (*Server) KeysURL

func (s *Server) KeysURL() string

Jump to

Keyboard shortcuts

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