sandstormhdr

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package sandstormhdr reads Sandstorm information from HTTP request headers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasPermission

func HasPermission(h http.Header, perm string) bool

HasPermission reports whether the request header contains a permission.

func Permissions

func Permissions(h http.Header) []string

Permissions extracts the permissions in the request header.

func SessionID

func SessionID(h http.Header) string

SessionID returns the session identifier.

func UserName

func UserName(h http.Header) string

UserName extracts the user's display name from a request header. This may be non-empty even if the user is not logged in.

Types

type User

type User struct {
	// ID is a globally unique identifier for the user.
	ID string

	// Name is the user's display name.
	Name string

	// PreferredHandle is a handle, consisting of ASCII letters, numbers, and underscores.
	Handle string

	// PictureURL is a URL to a 64x64 profile picture.
	PictureURL string

	// Pronouns is the user's preferred pronouns.
	// One of "neutral", "male", "female", or "robot".
	Pronouns string
}

A User represents a Sandstorm user.

func GetUser

func GetUser(h http.Header) *User

GetUser extracts the user information from a request header or nil if the user is not logged in.

func (*User) String

func (u *User) String() string

String returns the user's display name.

Jump to

Keyboard shortcuts

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