public class HttpOAuthHelper extends AuthenticatorHelper
{ @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 |
Constructor and Description |
---|
HttpOAuthHelper()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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.
|
static String |
getErrorPageTemplate(Context c) |
static String |
getLoginPage(Context c)
Returns the value of the "loginPage" 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.
|
static void |
setErrorPageTemplate(String errorPageTemplate,
Context c) |
static void |
setLoginPage(String loginPage,
Context c)
Sets the value of the "loginPage" parameter.
|
formatResponse, getChallengeScheme, getLogger, isClientSide, isServerSide, parseResponse, setChallengeScheme, setClientSide, setServerSide, updateReference
public HttpOAuthHelper()
ChallengeScheme.HTTP_OAUTH
authentication
scheme.public static String getAuthPage(Context c)
c
- The context where to find the parameter.public static String getAuthPageTemplate(Context c)
c
- The context where to find the parameter.public static boolean getAuthSkipApproved(Context c)
c
- The context where to find the parameter.public static String getLoginPage(Context c)
c
- The context where to find the parameter.public static void setAuthPage(String authPage, Context c)
authPage
- The value of the "authPage" parameter.c
- The context to update.public static void setAuthPageTemplate(String authPageTemplate, Context c)
authPageTemplate
- The value of the "authPageTemplate" parameter.c
- The context to update.public static void setAuthSkipApproved(boolean skip, Context c)
skip
- The value of the "authSkipApproved" parameter.c
- The context to update.public static void setLoginPage(String loginPage, Context c)
loginPage
- The value of the "loginPage" parameter.c
- The context to update.public void formatRequest(ChallengeWriter cw, ChallengeRequest challenge, Response response, Series<Header> httpHeaders) throws IOException
formatRequest
in class AuthenticatorHelper
IOException
public void parseRequest(ChallengeRequest challenge, Response response, Series<Header> httpHeaders)
parseRequest
in class AuthenticatorHelper
Copyright © 2005-2014 Restlet.