English ▼
Skip to page content Skip to main navigation
e.g. "templates" or "datastore"

# The user package

## Introduction

Package user provides a client for App Engine's user authentication service.

## Functions

func IsAdmin

  `func IsAdmin(c appengine.Context) bool`

  IsAdmin returns true if the current user is signed in and is currently registered as an administrator of the application.

func LoginURL

  `func LoginURL(c appengine.Context, dest string) (string, os.Error)`

  LoginURL returns a URL that, when visited, prompts the user to sign in, then redirects the user to the URL specified by 'dest'.

func LoginURLFederated

  `func LoginURLFederated(c appengine.Context, dest, identity string) (string, os.Error)`

  LoginURLFederated is like LoginURL but accepts a user's OpenID identifier.

func LogoutURL

  `func LogoutURL(c appengine.Context, dest string) (string, os.Error)`

  LogoutURL returns a URL that, when visited, signs the user out, then redirects the user to the URL specified by 'dest'.

## Types

type User

User represents a user of the application.

Its fields are not validated. A User whose email address does not correspond to a valid Google account can be stored in the datastore, but will never match a real user.

      type User struct {
          Email      string
          AuthDomain string

          // Id is the unique permanent ID of the user.
          // It is populated if the Email is associated
          // with a Google account, or empty otherwise.
          Id string

          FederatedIdentity string
          FederatedProvider string
      }

  func Current

    `func Current(c appengine.Context) *User`

    Current returns the currently logged-in user, or nil if the user is not signed in.

  func (*User) String

    `func (u *User) String() string`

    String returns a displayable name for the user.