Documentation
¶
Overview ¶
Package auth controls how users and services authenticate
Index ¶
- Constants
- func GetCurrentUserUUIDFromHeader(data http.Header) (uuid string, err error)
- func GetCurrentUserUUIDFromMetadata(data metadata.MD) (uuid string, err error)
- func LoginUser(uuid string, support, rememberMe bool, res http.ResponseWriter)
- func Logout(res http.ResponseWriter)
- func ProxyHeaders(from, to http.Header)
- func SetInternalHeaders(externalReq *http.Request, internalHeaders http.Header)
Constants ¶
View Source
const ( // AuthorizationHeader is the http request header // key used for accessing the internal authorization. AuthorizationHeader = "Authorization" // AuthorizationMetadata is the grpce metadadata key used // for accessing the internal authorization AuthorizationMetadata = "authorization" // AuthorizationAnonymousWeb is set as the Authorization header to denote that // a request is being made bu an unauthenticated web user AuthorizationAnonymousWeb = "faraday-anonymous" // AuthorizationAuthenticatedUser is set as the Authorization header to denote that // a request is being made by an authenticated web user AuthorizationAuthenticatedUser = "faraday-authenticated" // AuthorizationSupportUser is set as the Authorization header to denote that // a request is being made by a Staffjoy team me AuthorizationSupportUser = "faraday-support" // AuthorizationWWWService is set as the Authorization header to denote that // a request is being made by the www login / signup system AuthorizationWWWService = "www-service" // AuthorizationCompanyService is set as the Authorization header to denote // that a request is being made by the company api/server AuthorizationCompanyService = "company-service" // AuthorizationSuperpowersService is set as the Authorization header to // denote that a request is being made by the dev-only superpowers service AuthorizationSuperpowersService = "superpowers-service" // AuthorizationWhoamiService is set as the Authorization heade to denote that // a request is being made by the whoami microservice AuthorizationWhoamiService = "whoami-service" // AuthorizationBotService is set as the Authorization header to denote that // a request is being made by the bot microservice AuthorizationBotService = "bot-service" // AuthorizationAccountService is set as the Authorization header to denote that // a request is being made by the account service AuthorizationAccountService = "account-service" // AuthorizationICalService is set as the Authorization header to denote that // a request is being made by the ical service AuthorizationICalService = "ical-service" )
Variables ¶
This section is empty.
Functions ¶
func GetCurrentUserUUIDFromHeader ¶
GetCurrentUserUUIDFromHeader allows backend http services with authorization methods of AuthenticatedUser or SupportUser to access the uuid of the user making the request
func GetCurrentUserUUIDFromMetadata ¶
GetCurrentUserUUIDFromMetadata allows backend gRPC services with authorization methods of AuthenticatedUser or SupportUser to access the uuid of the user making the request
func LoginUser ¶
func LoginUser(uuid string, support, rememberMe bool, res http.ResponseWriter)
LoginUser sets a cookie to log in a user
func Logout ¶
func Logout(res http.ResponseWriter)
Logout forces an immediate logout of the current user. For internal applications - typically do an HTTP redirect to the www service `/logout/` route to trigger a logout.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.