Spiffy UI Framework

org.spiffyui.client.rest
Interface RESTAuthProvider

All Superinterfaces:
RESTAuthConstants
All Known Implementing Classes:
AuthUtil

public interface RESTAuthProvider
extends RESTAuthConstants

This interface defines the necessary steps to perform a login for a REST service that follows the Novell architecture council standard for tokenized identity.


Field Summary
 
Fields inherited from interface org.spiffyui.client.rest.util.RESTAuthConstants
AUTH_LOGOUT_URL_TOKEN, AUTH_URL_TOKEN, GONE, INVALID_AUTH_HEADER, INVALID_INPUT, INVALID_JSON, INVALID_LOGIN_REQUEST, INVALID_LOGOUT_REQUEST, INVALID_TS_URL, MULTIPLE_ACCOUNTS, NO_PRIVILEGE, NOTFOUND_TS_URL, PASSWORD_TOKEN, USER_TOKEN, USERNAME_TOKEN
 
Method Summary
 void finishRESTCall(java.lang.Object callBackKey)
           Once the login is completed we need to perform the original REST request with the new user token.
 java.lang.String getServletContext()
          Gets the servlet context from the current URL.
 void login(java.lang.String username, java.lang.String password, java.lang.String authUrl, RESTObjectCallBack<java.lang.String> callback)
           Perform login for the specified user credentials.
 void logout(RESTObjectCallBack<java.lang.String> callback)
           Logout the current user.
 void showLogin(RESTCallback callback, java.lang.String tokenServerUrl, java.lang.String code)
           Show the login dialog.
 

Method Detail

showLogin

void showLogin(RESTCallback callback,
               java.lang.String tokenServerUrl,
               java.lang.String code)

Show the login dialog.

This method is called when a REST call results in a 401 which requires login. The default implementation of this method shows a login dialog, but it could redirect to another page or simply show an error message.

Parameters:
callback - the callback for the original REST call
tokenServerUrl - the URL for the authentication server
code - the error code

finishRESTCall

void finishRESTCall(java.lang.Object callBackKey)

Once the login is completed we need to perform the original REST request with the new user token.

This gives the framework a chance to repeat the request with the new token and have it complete successfully. This method is called after all of the login exchange is completed.

Parameters:
callBackKey - the callback object of the original REST call

logout

void logout(RESTObjectCallBack<java.lang.String> callback)

Logout the current user.

This method clears all local variables, removes the session cookie, and issues the logout request to the server. The logout request to the server is typically a REST request made to the same URL as the login request but using an HTTP DELETE.

Parameters:
callback - the REST callback to indicate the call is completed

login

void login(java.lang.String username,
           java.lang.String password,
           java.lang.String authUrl,
           RESTObjectCallBack<java.lang.String> callback)

Perform login for the specified user credentials.

This method makes a REST request to the authentication server (through the authentication) proxy and gets the token based on the specified credentials.

Parameters:
username - the username
password - the password
authUrl - the URL of the authentication server
callback - the REST callback for the original REST call

getServletContext

java.lang.String getServletContext()
Gets the servlet context from the current URL. The context is assumed to be the string after the first single forward slash and before the next forward slash.

Returns:
the current server servlet context

Spiffy UI Framework