auth

package
v0.0.0-...-c34d2c7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package auth controls how users and services authenticate

Index

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

func GetCurrentUserUUIDFromHeader(data http.Header) (uuid string, err error)

GetCurrentUserUUIDFromHeader allows backend http services with authorization methods of AuthenticatedUser or SupportUser to access the uuid of the user making the request

func GetCurrentUserUUIDFromMetadata

func GetCurrentUserUUIDFromMetadata(data metadata.MD) (uuid string, err error)

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.

func ProxyHeaders

func ProxyHeaders(from, to http.Header)

ProxyHeaders copies http headers

func SetInternalHeaders

func SetInternalHeaders(externalReq *http.Request, internalHeaders http.Header)

SetInternalHeaders is used by Faraday to sanitize incoming external requests and convert them to internal requests with authorization information

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL