CommonTasksResource.java revision 16682c615640da7d54591f86528a5eb562e0ab97
/*
* 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 legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2015 ForgeRock AS.
*/
/**
* CREST resource which returns configuration details about each available common task wizard.
*
* <pre>
* {
* "name" : "Create SAMLv2 Providers",
* "description" : "Use these work flows to create hosted or remote identity and service providers for SAMLv2
* Federation.",
* "tasks" : [ {
* "name" : "Create Hosted Identity Provider",
* "description" : "This allows you to configure this instance of OpenAM server as an Identity Provider (IDP).
* You need three things: Name, Circle of Trust (COT) and optionally Signing Certificate. Metadata represents
* the configuration necessary to execute federation protocols (eg SAMLv2) as well as the mechanism to
* communicate this configuration to other entities (eg SPs) in a COT. A COT is a group of IDPs and SPs that
* trust each other and in effect represents the confines within which all federation communications are
* performed.",
* "link" : "task/CreateHostedIDP"
* }, {
* "name" : "Create Hosted Service Provider",
* "description" : "This allows you to configure this instance of OpenAM server as an Service Provider (SP).
* You need three things: Name, Circle of Trust (COT). Metadata represents the configuration necessary to
* execute federation protocols (eg SAMLv2) as well as the mechanism to communicate this configuration to
* other entities (eg IDPs) in a COT. A COT is a group of IDPs and SPs that trust each other and in effect
* represents the confines within which all federation communications are performed.",
* "link" : "task/CreateHostedSP"
* }, {
* "name" : "Register Remote Identity Provider",
* "description" : "This allows you to register a remote Identity Provider (IDP). You need two things: Circle
* of Trust (COT). Metadata represents the configuration necessary to execute federation protocols (eg SAMLv2)
* as well as the mechanism to communicate this configuration to other entities (eg SPs) in a COT. A COT is a
* group of IDPs and SPs that trust each other and in effect represents the confines within which all
* federation communications are performed.",
* "link" : "task/CreateRemoteIDP"
* }, {
* "name" : "Register Remote Service Provider",
* "description" : "This allows you to register a remote Service Provider (SP). You need two things: Circle
* of Trust (COT). Metadata represents the configuration necessary to execute federation protocols (eg SAMLv2)
* as well as the mechanism to communicate this configuration to other entities (eg SPs) in a COT. A COT is
* a group of IDPs and SPs that trust each other and in effect represents the confines within which all
* federation communications are performed.",
* "link" : "task/CreateRemoteSP"
* }
* }
* </pre>
*
* @since 13.0.0
*/
class CommonTasksResource implements CollectionResourceProvider {
private final CommonTasksConfigurationManager configurationManager;
public CommonTasksResource() {
this.configurationManager = new CommonTasksConfigurationManager();
}
public Promise<ActionResponse, ResourceException> actionCollection(Context context, ActionRequest request) {
return new NotSupportedException().asPromise();
}
public Promise<ActionResponse, ResourceException> actionInstance(Context context, String resourceId,
return new NotSupportedException().asPromise();
}
public Promise<ResourceResponse, ResourceException> createInstance(Context context, CreateRequest request) {
return new NotSupportedException().asPromise();
}
public Promise<ResourceResponse, ResourceException> deleteInstance(Context context, String resourceId,
return new NotSupportedException().asPromise();
}
public Promise<ResourceResponse, ResourceException> patchInstance(Context context, String resourceId,
return new NotSupportedException().asPromise();
}
public Promise<QueryResponse, ResourceException> queryCollection(Context context, QueryRequest request, QueryResourceHandler handler) {
}
//TODO pass in locale
JsonValue configuration = configurationManager.getCommonTasksConfiguration(getResourceBundle(locale));
handler.handleResource(newResourceResponse(key, String.valueOf(resource.getObject().hashCode()), resource));
}
return newResultPromise(newQueryResponse());
}
public Promise<ResourceResponse, ResourceException> readInstance(Context context, String resourceId,
//TODO pass in locale
JsonValue configuration = configurationManager.getCommonTasksConfiguration(getResourceBundle(locale));
}
return newResultPromise(newResourceResponse(resourceId, String.valueOf(resource.getObject().hashCode()), resource));
}
public Promise<ResourceResponse, ResourceException> updateInstance(Context context, String resourceId,
return new NotSupportedException().asPromise();
}
}
private static final class CommonTasksConfigurationManager {
field("socialauthentication",
field("testfederation",
field("soapstsdeployment",
));
}
}
}
}
}
}
}
private JsonValue getTestFederationConnectivityCommonTaskConfiguration(ResourceBundle resourceBundle) {
}
}
private JsonValue getCreateSoapSTSDeploymentCommonTaskConfiguration(ResourceBundle resourceBundle) {
}
private JsonValue createTaskGroup(ResourceBundle resourceBundle, String nameSuffix, Object... tasks) {
return taskGroup;
}
return object(
}
private Object createTaskWithAbsoluteLink(ResourceBundle resourceBundle, String taskSuffix, String link) {
return object(
}
}
}