auth

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//descripes how the userid is used
	JWT_USERTYPE_USER_RECORD string = "usr"
	JWT_USERTYPE_SYSTEM_ID   string = "sys"

	JWT_DURATION_SHORT int64 = 3600
	JWT_DURATION_LONG  int64 = 604800

	JWT_DURATION_NEVER int64 = -1

	REQUEST_SOURCE_APPENGINE_TASK string = "appengine-task"

	JWT_AUDIENCE_COOKIE string = "cookie" //will vet cookie / header, does not necessarily vet against db
	JWT_AUDIENCE_APP    string = "app"    //for app usual usage, does not necessarily vet against db
	JWT_AUDIENCE_OOB    string = "oob"    //for passing around via email, page embeds, etc. - always vets against db
)
View Source
const (
	SYSTEM_ID_OAUTH
)

Variables

This section is empty.

Functions

func DestroyToken

func DestroyToken(rData *pages.RequestData) error

func GetFinalDurationByAudience

func GetFinalDurationByAudience(audience string) int64

func GetInitialDurationByAudience

func GetInitialDurationByAudience(audience string) int64

func GetJwtFromDb

func GetJwtFromDb(rData *pages.RequestData, keyVal interface{}) (*datastore.JwtRecord, bool)

func GetJwtFromString

func GetJwtFromString(rData *pages.RequestData, jwtString string, forceDbCheck bool) (*datastore.JwtRecord, bool)

func GetNewLoginJWT

func GetNewLoginJWT(rData *pages.RequestData, userRecord *datastore.UserRecord, audience string) (*datastore.JwtRecord, string, error)

func GetNewSystemsOobJWT

func GetNewSystemsOobJWT(rData *pages.RequestData, systemId int64, scopes int64, extra string) (*datastore.JwtRecord, string, error)

func GetNewUserOobJWT

func GetNewUserOobJWT(rData *pages.RequestData, userRecord *datastore.UserRecord, scopes int64, extraMap map[string]interface{}) (*datastore.JwtRecord, string, error)

func SetJWTCookie

func SetJWTCookie(rData *pages.RequestData, jwtString string, sid string, duration int)

func SignJwt

func SignJwt(ctx context.Context, jwtRecord *datastore.JwtRecord) (string, error)

func UnsetJWTCookie

func UnsetJWTCookie(rData *pages.RequestData)

func ValidatePageRequest

func ValidatePageRequest(rData *pages.RequestData) (bool, bool)

func ValidateUserType

func ValidateUserType(rData *pages.RequestData, jwtRecord *datastore.JwtRecord) (bool, interface{})

Types

type SigningMethodAppEngine

type SigningMethodAppEngine struct{}

Implements the built-in AppEngine signing method This method uses a private key unique to your AppEngine application and the key may rotate from time to time. https://cloud.google.com/appengine/docs/go/reference#SignBytes https://cloud.google.com/appengine/docs/go/appidentity/#Go_Asserting_identity_to_other_systems

func (*SigningMethodAppEngine) Alg

func (s *SigningMethodAppEngine) Alg() string

func (*SigningMethodAppEngine) Sign

func (s *SigningMethodAppEngine) Sign(signingString string, key interface{}) (string, error)

Implements the Sign method from SigningMethod For this signing method, a valid appengine.Context must be passed as the key.

func (*SigningMethodAppEngine) Verify

func (s *SigningMethodAppEngine) Verify(signingString, signature string, key interface{}) error

Implements the Verify method from SigningMethod For this signing method, a valid appengine.Context must be passed as the key.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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