Authentication

User authentication is performed using OpenID against the Google OpenID Provider endpoint. Any user with a Google Account can be authorized and identified by a UOW server.

API

uow.getUser() → dojo.Deferred

This method retrieves information about the user logged into the current domain.

The return value is a dojo.Deferred. You should invoke then on the deferred to register a callback function that will receive a object with the following properties:

email (string)
The email address of the user.
first_name (string)
The user's given name.
last_name (string)
The user's family name.
locale (string)
The IETF language tag for the user's locale.
name (string)
The full name of the user for display.
role (string)
The role assigned to the user in the current UOW domain. The common values are the following, but custom roles can be assigned. See the Database documentation for details about how roles are mapped to database permissions (todo).
developer
An authenticated developer with full permissions (e.g., you).
admin
An authenticated user with administrative permissions where you define what "administrator" means for your application.
author
An authenticated user with edit permissions where you define what "editor" means for your application.
identified
An authenticated user with no other, more specific role assigned.
anonymous
An unknown, unauthenticated user.

uow.logout() → undefined

This method removes the authentication cookie for the user currently logged into the current domain. After removing the cookie, the method refreshes the page to ensure no private data remains displayed.

This method returns no value as the page always refreshes after invocation.

uow.triggerLogin() → dojo.Deferred

This method attempts to authenticate the current user via a Google Account. A popup window appears in which Google asks the user to create a new Google Account or sign into an existing account if the user is not currently signed into any Google service. Once signed in, the popup windows asks the user to allow or deny the UOW server access to his or her name, email address, etc. for authentication.

The return value is a dojo.Deferred. You should invoke then on the deferred to register a callback function that will receive a object with the following properties:

flag (string)
The string ok on successful login.
user (object)
The same user object provided by uow.getUser(). See below.

Examples

Get information about the logged in user

var def = uow.getUser();
def.then(function(user) {
  var text = dojo.toJson(user);
  dojo.byId('auth_ex1log').innerHTML = text;
});