org.restlet.ext.oauth
Class HttpOAuthHelper

java.lang.Object
  extended by org.restlet.engine.Helper
      extended by org.restlet.engine.security.AuthenticatorHelper
          extended by org.restlet.ext.oauth.HttpOAuthHelper

public class HttpOAuthHelper
extends AuthenticatorHelper

Implementation of OAuth2 Authentication. If this helper is not automatically added to your Engine add it with:

 {
     @code
     List<AuthenticatorHelper> authenticators = Engine.getInstance()
             .getRegisteredAuthenticators();
     authenticators.add(new OAuthAuthenticationHelper());
 }
 
Here is the list of parameters that are supported. They should be set before an OAuth2Server or Client is started:
Parameter name Value type Default value Description
authPage String auth_page Specifies where an AuthorizationServerResource should redirect authorization requests for user interaction. This resource will be accessed using riap, i.e. riap://application/+authPage
authPageTemplate String null Specifies an html file or freemarker template for a GUI. If none is provided Roles (scopes) will automatically granted. Accessed using clap, i.e. clap:///+authPageTemplate
authPageTemplate String null Specifies an html file or freemarker template for a GUI. If none is provided Roles (scopes) will automatically granted. Used by AuthPageServerResource
authSkipApproved boolean false If true no authorization page will be shown if the Roles (scopes) have been previously approved by the user
loginPage String login Specifing a login resource location relative to the Application root. Defaults to "login". This resource will be accessed using riap, i.e. riap://application/+loginPage

Author:
Kristoffer Gronowski

Constructor Summary
HttpOAuthHelper()
          Constructor.
 
Method Summary
 void formatRequest(ChallengeWriter cw, ChallengeRequest challenge, Response response, Series<Header> httpHeaders)
           
static String getAuthPage(Context c)
          Returns the value of the "authPage" parameter.
static String getAuthPageTemplate(Context c)
          Returns the value of the "authPageTemplate" parameter.
static boolean getAuthSkipApproved(Context c)
          Returns the value of the "authSkipApproved" parameter.
 void parseRequest(ChallengeRequest challenge, Response response, Series<Header> httpHeaders)
           
static void setAuthPage(String authPage, Context c)
          Sets the value of the "authpage" parameter.
static void setAuthPageTemplate(String authPageTemplate, Context c)
          Sets the value of the "authPageTemplate" parameter.
static void setAuthSkipApproved(boolean skip, Context c)
          Sets the value of the "authSkipApproved" parameter.
 
Methods inherited from class org.restlet.engine.security.AuthenticatorHelper
formatResponse, getChallengeScheme, getLogger, isClientSide, isServerSide, parseResponse, setChallengeScheme, setClientSide, setServerSide, updateReference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpOAuthHelper

public HttpOAuthHelper()
Constructor. Use the ChallengeScheme.HTTP_OAUTH authentication scheme.

Method Detail

getAuthPage

public static String getAuthPage(Context c)
Returns the value of the "authPage" parameter.

Parameters:
c - The context where to find the parameter.
Returns:
The value of the "authPage" parameter.

getAuthPageTemplate

public static String getAuthPageTemplate(Context c)
Returns the value of the "authPageTemplate" parameter.

Parameters:
c - The context where to find the parameter.
Returns:
The value of the "authPageTemplate" parameter.

getAuthSkipApproved

public static boolean getAuthSkipApproved(Context c)
Returns the value of the "authSkipApproved" parameter.

Parameters:
c - The context where to find the parameter.
Returns:
The value of the "authSkipApproved" parameter.

setAuthPage

public static void setAuthPage(String authPage,
                               Context c)
Sets the value of the "authpage" parameter.

Parameters:
authPage - The value of the "authpage" parameter.
c - The context to update.

setAuthPageTemplate

public static void setAuthPageTemplate(String authPageTemplate,
                                       Context c)
Sets the value of the "authPageTemplate" parameter.

Parameters:
authPageTemplate - The value of the "authPageTemplate" parameter.
c - The context to update.

setAuthSkipApproved

public static void setAuthSkipApproved(boolean skip,
                                       Context c)
Sets the value of the "authSkipApproved" parameter.

Parameters:
skip - The value of the "authSkipApproved" parameter.
c - The context to update.

formatRequest

public void formatRequest(ChallengeWriter cw,
                          ChallengeRequest challenge,
                          Response response,
                          Series<Header> httpHeaders)
                   throws IOException
Overrides:
formatRequest in class AuthenticatorHelper
Throws:
IOException

parseRequest

public void parseRequest(ChallengeRequest challenge,
                         Response response,
                         Series<Header> httpHeaders)
Overrides:
parseRequest in class AuthenticatorHelper


Copyright © 2005-2013 Restlet.