OAuth2FlowFinder.java revision c3791e48cd72e76169350053ac1c737d2a081cd6
/*
* DO NOT REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2012 ForgeRock Inc. All rights reserved.
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*/
/**
* <p/>
* If it request for Authorization Endpoint then the response_type [code,token]
* <p/>
* If it request for Token Endpoint then the grant_type
* [authorization_code,password
* ,client_credentials,refresh_token,urn:ietf:params:
* oauth:grant-type:saml2-bearer]
*/
public class OAuth2FlowFinder extends Finder {
/**
* Constructor.
*
* @param context
* The context.
*/
super(context, ErrorServerResource.class);
this.endpointType = endpointType;
}
/**
* Creates a new instance of the {@link ServerResource} subclass designated
* by the "targetClass" property. The default behavior is to invoke the
* {@link #create(Class, org.restlet.Request, org.restlet.Response)} with
* the "targetClass" property as a parameter.
*
* @param request
* The request to handle.
* @param response
* The response to update.
* @return The created resource or ErrorServerResource.
*/
/*
* If an authorization request is missing the "response_type" parameter,
* or if the response type is not understood, the authorization server
* MUST return an error response as described in Section 4.1.2.1.
*/
switch (endpointType) {
case AUTHORIZATION_ENDPOINT: {
}
case TOKEN_ENDPOINT: {
}
default: {
}
}
}
if (targetClass != null) {
try {
// Invoke the default constructor
} catch (Exception e) {
"Exception while instantiating the target server resource.", e);
.pushException();
result = new ErrorServerResource();
}
}
return result;
}
if (propertyName != null) {
if (targetClass == null) {
} else {
}
}
} else {
"Type is not set").pushException();
}
} else {
.pushException();
}
return targetClass;
}
public OAuth2FlowFinder supportAuthorizationCode() {
AuthorizationCodeServerResource.class);
AuthorizationCodeServerResource.class);
return this;
}
public OAuth2FlowFinder supportImplicit() {
ImplicitGrantServerResource.class);
return this;
}
public OAuth2FlowFinder supportClientCredentials() {
ClientCredentialsServerResource.class);
return this;
}
public OAuth2FlowFinder supportPassword() {
return this;
}
public OAuth2FlowFinder supportSAML20() {
return this;
}
}