Documentation
¶
Overview ¶
Package auth implement the auth system from the openslides-auth-service: https://github.com/OpenSlides/openslides-auth-service
Index ¶
Constants ¶
const ( DebugTokenKey = "auth-dev-token-key" DebugCookieKey = "auth-dev-cookie-key" )
DebugTokenKey and DebugCookieKey are non random auth keys for development.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth authenticates a request against the openslides-auth-service.
Has to be initialized with auth.New().
func New ¶
func New(lookup environment.Environmenter, messageBus LogoutEventer) (*Auth, func(context.Context, func(error)), error)
New initializes the Auth object.
Returns the initialized Auth objectand a function to be called in the background.
func (*Auth) Authenticate ¶
Authenticate uses the headers from the given request to get the user id. The returned context will be cancled, if the session is revoked.
func (*Auth) AuthenticatedContext ¶
AuthenticatedContext returns a new context that contains an userID.
Should only used for internal URLs. All other URLs should use auth.Authenticate.