Documentation ¶
Overview ¶
Package tokens manages token authentication
Index ¶
- Constants
- Variables
- func TokenFlashMessage(renderer html.Renderer, w http.ResponseWriter, token []byte) error
- type GetOrCreateUser
- type GoogleIAPConfig
- type NewTokenOption
- type Options
- type Service
- func (r Service) GetSubject(ctx context.Context, jwtSubject resource.ID) (authz.Subject, error)
- func (a *Service) Middleware() mux.MiddlewareFunc
- func (f Service) NewToken(subjectID resource.ID, opts ...NewTokenOption) ([]byte, error)
- func (r Service) RegisterKind(k resource.Kind, fn SubjectGetter)
- func (r Service) RegisterSiteToken(token string, siteAdmin authz.Subject)
- func (a *Service) StartSession(w http.ResponseWriter, r *http.Request, userID resource.ID) error
- type SubjectGetter
Constants ¶
View Source
const (
// session cookie stores the session token
SessionCookie = "session"
)
Variables ¶
View Source
var AuthenticatedPrefixes = []string{ tfeapi.APIPrefixV2, tfeapi.ModuleV1Prefix, otfapi.DefaultBasePath, paths.UIPrefix, }
AuthenticatedPrefixes are those URL path prefixes requiring authentication.
Functions ¶
func TokenFlashMessage ¶ added in v0.2.0
TokenFlashMessage is a helper for rendering a flash message with an authentication token.
Types ¶
type GetOrCreateUser ¶ added in v0.3.6
GetOrCreateUser retrieves the user with the given username. If the user does not exist it is created.
type GoogleIAPConfig ¶
type GoogleIAPConfig struct {
Audience string
}
type NewTokenOption ¶ added in v0.3.6
func WithExpiry ¶ added in v0.3.6
func WithExpiry(exp time.Time) NewTokenOption
type Service ¶ added in v0.2.2
func NewService ¶
func (Service) GetSubject ¶ added in v0.2.2
func (*Service) Middleware ¶ added in v0.2.2
func (a *Service) Middleware() mux.MiddlewareFunc
Middleware returns middleware for authenticating tokens
func (Service) NewToken ¶ added in v0.2.2
func (f Service) NewToken(subjectID resource.ID, opts ...NewTokenOption) ([]byte, error)
func (Service) RegisterKind ¶ added in v0.2.2
func (r Service) RegisterKind(k resource.Kind, fn SubjectGetter)
RegisterKind registers a kind of authentication token, providing a func that can retrieve the OTF subject indicated in the token.
func (Service) RegisterSiteToken ¶ added in v0.2.2
RegisterSiteToken registers a site token which the middleware, and the subject to return as the site admin upon successful authentication.
func (*Service) StartSession ¶ added in v0.2.2
Click to show internal directories.
Click to hide internal directories.