|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.engine.Helper
org.restlet.engine.security.AuthenticatorHelper
org.restlet.ext.oauth.HttpOAuthHelper
public class HttpOAuthHelper
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 |
| 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 |
|---|
public HttpOAuthHelper()
ChallengeScheme.HTTP_OAUTH authentication
scheme.
| Method Detail |
|---|
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 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 void formatRequest(ChallengeWriter cw,
ChallengeRequest challenge,
Response response,
Series<Header> httpHeaders)
throws IOException
formatRequest in class AuthenticatorHelperIOException
public void parseRequest(ChallengeRequest challenge,
Response response,
Series<Header> httpHeaders)
parseRequest in class AuthenticatorHelper
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||