appengine

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// UserIDKey is App Engine User ID Header Key
	UserIDKey = "X-Appengine-User-Id"

	// UserEmailKey is App Engine User Email Header Key
	UserEmailKey = "X-Appengine-User-Email"

	// UserNicknameKey is App Engine User Nickname Header Key
	UserNicknameKey = "X-Appengine-User-Nickname"

	// UserIsAdminKey is App Engine User Is Admin Key
	UserIsAdminKey = "X-Appengine-User-Is-Admin"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	ID       string
	Email    string
	Nickname string
	Admin    bool
}

User is IAPを通してログインしているUser App Engine 用

note: Every user has the same user ID for all App Engine applications. If your app uses the user ID in public data, such as by including it in a URL parameter, you should use a hash algorithm with a "salt" value added to obscure the ID. Exposing raw IDs could allow someone to associate a user's activity in one app with that in another, or get the user's email address by coercing the user to sign in to another app.

func CurrentUser

func CurrentUser(ctx context.Context) *User

CurrentUser is context からUserを取得する

CurrentUserWithContext()で返ってきたcontextを渡すと、その中からuserを取り出す

func CurrentUserWithContext

func CurrentUserWithContext(ctx context.Context, r *http.Request) (context.Context, *User)

CurrentUserWithContext is IAPを通してログインしているUserを取得する

Jump to

Keyboard shortcuts

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