Documentation ¶
Overview ¶
Package authtest provides some simple JWT token testing functionality for use in Ensign SDK tests. This package is disconnected from the Quarterdeck server, so the tests must be kept up to date with expected Quarterdeck responses.
Index ¶
- Constants
- func Err(w http.ResponseWriter, status int, err error)
- type Claims
- type Server
- func (s *Server) Authenticate(w http.ResponseWriter, r *http.Request)
- func (s *Server) Close()
- func (s *Server) CreateAccessToken(claims *Claims) *jwt.Token
- func (s *Server) CreateRefreshToken(accessToken *jwt.Token) *jwt.Token
- func (s *Server) CreateToken(claims *Claims) *jwt.Token
- func (s *Server) CreateTokenPair(claims *Claims) (atks, rtks string, err error)
- func (s *Server) Refresh(w http.ResponseWriter, r *http.Request)
- func (s *Server) Register() (clientID, clientSecret string)
- func (s *Server) ResolveReference(u *url.URL) string
- func (s *Server) Sign(token *jwt.Token) (tks string, err error)
- func (s *Server) Status(w http.ResponseWriter, r *http.Request)
- func (s *Server) URL() string
Constants ¶
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Claims ¶
type Claims struct { jwt.RegisteredClaims OrgID string `json:"org,omitempty"` ProjectID string `json:"project,omitempty"` Permissions []string `json:"permissions,omitempty"` }
Claims implements Quarterdeck-like claims for use in testing the SDK client.
type Server ¶
type Server struct {
// 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 ¶
NewServer starts and returns a new authtest server. The caller should call Close when finished, to shut it down.
func (*Server) Authenticate ¶
func (s *Server) Authenticate(w http.ResponseWriter, r *http.Request)
func (*Server) CreateAccessToken ¶
func (*Server) CreateRefreshToken ¶
func (s *Server) CreateRefreshToken(accessToken *jwt.Token) *jwt.Token
func (*Server) CreateToken ¶
func (*Server) CreateTokenPair ¶
Click to show internal directories.
Click to hide internal directories.