Documentation ¶
Overview ¶
Package tokens manages token authentication
Index ¶
- Constants
- Variables
- func NewService(opts Options) (*service, error)
- func NewTestSessionJWT(t *testing.T, username string, secret []byte, lifetime time.Duration) string
- func TokenFlashMessage(renderer html.Renderer, w http.ResponseWriter, token []byte) error
- type GoogleIAPConfig
- type Kind
- type NewTokenOptions
- type Options
- type StartSessionOptions
- type SubjectGetter
- type TokensService
- type UISubjectGetterOrCreator
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 NewService ¶
func NewTestSessionJWT ¶
func TokenFlashMessage ¶ added in v0.2.0
TokenFlashMessage is a helper for rendering a flash message with an authentication token.
Types ¶
type GoogleIAPConfig ¶
type GoogleIAPConfig struct {
Audience string
}
type Kind ¶
type Kind string
the Kind of authentication token: user session, user token, agent token, etc
type NewTokenOptions ¶
type StartSessionOptions ¶
type SubjectGetter ¶ added in v0.2.0
SubjectGetter retrieves an OTF subject given the jwtSubject string, which is the value of the 'subject' field parsed from a JWT.
type TokensService ¶
type TokensService interface { Middleware() mux.MiddlewareFunc NewToken(NewTokenOptions) ([]byte, error) RegisterKind(Kind, SubjectGetter) RegisterSiteToken(token string, siteAdmin internal.Subject) RegisterUISubjectGetterOrCreator(fn UISubjectGetterOrCreator) NewSessionToken(username string, expiry time.Time) (string, error) // contains filtered or unexported methods }
Click to show internal directories.
Click to hide internal directories.