net.oauth.core
oauth-provider
diff --git a/src/main/java/org/imsglobal/lti2/LTI2Config.java b/src/main/java/org/imsglobal/lti2/LTI2Config.java
deleted file mode 100644
index 638dc55..0000000
--- a/src/main/java/org/imsglobal/lti2/LTI2Config.java
+++ /dev/null
@@ -1,37 +0,0 @@
-
-package org.imsglobal.lti2;
-
-// Capture the information needed to build a tool profile
-public interface LTI2Config {
- // A globally unique identifier for the service. The domain name is typical.
- // The scope for this is tenant/customer
- public String getGuid();
- public String getSupport_email();
-
- // In a multi-tenant environment this data describes the tenant / customer.
- public String getService_owner_id();
- public String getService_owner_owner_name();
- public String getService_owner_description();
- public String getService_owner_support_email();
-
- // This represents the service provider that hosts a product.
- // If this is self hosted, it is reasonable that these values
- // are the same as the "owner" values above.
- public String getService_provider_id();
- public String getService_provider_provider_name();
- public String getService_provider_description();
- public String getService_provider_support_email();
-
- // This section is general information about the software product
- public String getProduct_family_product_code();
- public String getProduct_family_vendor_code();
- public String getProduct_family_vendor_name();
- public String getProduct_family_vendor_description();
- public String getProduct_family_vendor_website();
- public String getProduct_family_vendor_contact();
-
- // This is about one particular version of a product
- public String getProduct_info_product_name();
- public String getProduct_info_product_version();
- public String getProduct_info_product_description();
-}
diff --git a/src/main/java/org/imsglobal/lti2/LTI2ConfigSample.java b/src/main/java/org/imsglobal/lti2/LTI2ConfigSample.java
deleted file mode 100644
index 0abc89d..0000000
--- a/src/main/java/org/imsglobal/lti2/LTI2ConfigSample.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.imsglobal.lti2;
-
-public class LTI2ConfigSample implements LTI2Config {
-
- // A globally unique identifier for the service. The domain name is typical.
- // The scope for this is tenant/customer
- public String getGuid() {
- return "edunext.school.edu";
- }
- public String getSupport_email() {
- return "support@edunext.school.edu";
- }
-
- // In a multi-tenant environment this data describes the tenant / customer.
- public String getService_owner_id() {
- return "https://edunext.school.edu";
- }
- public String getService_owner_owner_name() {
- return "ETS at SchoolEdu";
- }
- public String getService_owner_description() {
- return "The Ed. Tech Services Division of SchoolEdu";
- }
- public String getService_owner_support_email() {
- return "edunext@school.edu";
- }
-
- // This represents the service provider that hosts a product.
- // If this is self hosted, it is reasonable that these values
- // are the same as the "owner" values above.
- public String getService_provider_id() {
- return "https://hosting.example.com";
- }
- public String getService_provider_provider_name() {
- return "Example Hosting Services";
- }
- public String getService_provider_description() {
- return "We are the best example of a hosting services for EduNext.";
- }
- public String getService_provider_support_email() {
- return "sales@hosting.example.com";
- }
-
- // This section is about the software product
- public String getProduct_family_product_code() {
- return "edunext";
- }
- public String getProduct_family_vendor_code() {
- return "edunext";
- }
- public String getProduct_family_vendor_name() {
- return "Edu Next Project";
- }
- public String getProduct_family_vendor_description() {
- return "EduNext is whats next in education.";
- }
- public String getProduct_family_vendor_website() {
- return "http://www.edunext.example.com";
- }
- public String getProduct_family_vendor_contact() {
- return "sales@edunext.sample.com";
- }
-
- // This is about one particular version of a product.
- public String getProduct_info_product_name() {
- return "Classes";
- }
- public String getProduct_info_product_version() {
- return "2.0";
- }
- public String getProduct_info_product_description() {
- return "Classes 2.0";
- }
-}
diff --git a/src/main/java/org/imsglobal/lti2/LTI2Constants.java b/src/main/java/org/imsglobal/lti2/LTI2Constants.java
deleted file mode 100644
index 97d8710..0000000
--- a/src/main/java/org/imsglobal/lti2/LTI2Constants.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2013 IMS GLobal Learning Consortium
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- *
- */
-package org.imsglobal.lti2;
-
-public class LTI2Constants {
- /**
- * LTI2_VERSION_STRING=LTI-2p0
- *
- * This indicates an LTI 2.0 launch.
- */
- public static final String LTI2_VERSION_STRING = "LTI-2p0";
-
- /**
- * REG_KEY="9875"
- *
- * This is the registration key for the callback.
- */
- public static final String REG_KEY = "reg_key";
-
- /**
- * REG_PASSWORD="9875"
- *
- * This is the registration password for the callback.
- */
- public static final String REG_PASSWORD = "reg_password";
-
- /**
- * TC_PROFILE_URL
- *
- * This is the profile URL.
- */
- public static final String TC_PROFILE_URL = "tc_profile_url";
-
- public static final String JSONLD_ID = "@id";
- public static final String CONTEXT = "@context";
- public static final String TYPE = "@type";
- public static final String VALUE = "@value";
- public static final String GRAPH = "@graph";
-
- public static final String CUSTOM_URL = "custom_url";
- public static final String TOOL_PROXY_GUID = "tool_proxy_guid";
- public static final String SHARED_SECRET = "shared_secret";
- public static final String CUSTOM = "custom";
- public static final String SECURITY_CONTRACT = "security_contract";
- public static final String SERVICE = "service";
- public static final String TOOL_SERVICE = "tool_service";
- public static final String GRADE = "grade";
- public static final String GRADE_TYPE_DECIMAL = "decimal";
- public static final String COMMENT = "comment";
- public static final String RESULTSCORE = "resultScore";
-
- /**
- * Utility array useful for validating property names when building launch
- * data.
- */
- public static final String[] validPropertyNames = {
- REG_KEY, REG_PASSWORD, TC_PROFILE_URL };
-
-}
diff --git a/src/main/java/org/imsglobal/lti2/LTI2SampleData.java b/src/main/java/org/imsglobal/lti2/LTI2SampleData.java
deleted file mode 100644
index 1b4560d..0000000
--- a/src/main/java/org/imsglobal/lti2/LTI2SampleData.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.imsglobal.lti2;
-
-import java.util.Properties;
-import org.imsglobal.lti.BasicLTIConstants;
-
-public class LTI2SampleData {
-
- public static Properties getSubstitution() {
- Properties lti2subst = new Properties();
- lti2subst.setProperty("CourseOffering.id","context_id_999");
- lti2subst.setProperty("CourseOffering.label","SI364");
- lti2subst.setProperty("CourseOffering.title","Building Interactive Applications");
- lti2subst.setProperty("Membership.role","Instructor");
- lti2subst.setProperty("ResourceLink.id","res_link_999");
- lti2subst.setProperty("ResourceLink.title","My weekly blog");
- lti2subst.setProperty("User.id","user_id_007");
- lti2subst.setProperty("User.username","bond");
- lti2subst.setProperty("Person.name.given","James");
- lti2subst.setProperty("Person.name.family","Bond");
- lti2subst.setProperty("Person.name.full","James Bond");
- lti2subst.setProperty("Person.email.primary","bond@example.com");
- return lti2subst;
- }
-
- public static Properties getLaunch() {
- Properties launch = new Properties();
- launch.setProperty(BasicLTIConstants.CONTEXT_ID,"context_id_999");
- launch.setProperty(BasicLTIConstants.CONTEXT_LABEL,"SI364");
- launch.setProperty(BasicLTIConstants.CONTEXT_TITLE,"Building Interactive Applications");
- launch.setProperty(BasicLTIConstants.ROLES,"Instructor");
- launch.setProperty(BasicLTIConstants.RESOURCE_LINK_ID,"res_link_999");
- launch.setProperty(BasicLTIConstants.RESOURCE_LINK_TITLE,"My weekly blog");
- launch.setProperty(BasicLTIConstants.USER_ID,"user_id_007");
- launch.setProperty(BasicLTIConstants.LIS_PERSON_NAME_GIVEN,"James");
- launch.setProperty(BasicLTIConstants.LIS_PERSON_NAME_FAMILY,"Bond");
- launch.setProperty(BasicLTIConstants.LIS_PERSON_NAME_FULL,"James Bond");
- launch.setProperty(BasicLTIConstants.LIS_PERSON_CONTACT_EMAIL_PRIMARY,"bond@example.com");
- return launch;
- }
-
-}
diff --git a/src/main/java/org/imsglobal/lti2/LTI2Servlet.java b/src/main/java/org/imsglobal/lti2/LTI2Servlet.java
deleted file mode 100644
index cbe0cac..0000000
--- a/src/main/java/org/imsglobal/lti2/LTI2Servlet.java
+++ /dev/null
@@ -1,640 +0,0 @@
-/**
- * Copyright (c) 2013 IMS GLobal Learning Consortium
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- *
- * Author: Charles Severance
- */
-
-package org.imsglobal.lti2;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TreeMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.http.HttpStatus;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.ObjectWriter;
-import org.imsglobal.lti.BasicLTIConstants;
-import org.imsglobal.lti.BasicLTIUtil;
-import org.imsglobal.lti.launch.LtiVerificationResult;
-import org.imsglobal.json.IMSJSONRequest;
-import org.imsglobal.lti2.objects.consumer.ServiceOffered;
-import org.imsglobal.lti2.objects.consumer.StandardServices;
-import org.imsglobal.lti2.objects.consumer.ToolConsumer;
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.JSONValue;
-
-/**
- * Notes:
- *
- * This is a sample "Hello World" servlet for LTI2. It is a simple UI - mostly
- * intended to exercise the APIs and show the way for servlet-based LTI2 code.
- *
- * Here are the web.xml entries:
- *
- * {@code
- *
- * SampleServlet
- * org.imsglobal.lti2.LTI2Servlet
- *
- *
- * SampleServlet
- * /sample/*
- *
- * }
- *
- *
- * Then navigate to:
- * http://localhost/testservlet/sample/register
- *
- * A PHP endpoint is available at:
- *
- * https://source.sakaiproject.org/svn/basiclti/trunk/basiclti-docs/resources/docs/sakai-api-test
- *
- * The tp.php script is the Tool Provider registration endpoint in the PHP code
- *
- */
-
-@SuppressWarnings("deprecation")
-public class LTI2Servlet extends HttpServlet {
-
- private static final long serialVersionUID = 1L;
- private static Logger M_log = Logger.getLogger(LTI2Servlet.class.getName());
-
- protected ServiceOffered LTI2ResultItem = null;
- protected ServiceOffered LTI2LtiLinkSettings = null;
- protected ServiceOffered LTI2ToolProxyBindingSettings = null;
- protected ServiceOffered LTI2ToolProxySettings = null;
-
- private static final String SVC_tc_profile = "tc_profile";
- private static final String SVC_tc_registration = "tc_registration";
- private static final String SVC_Settings = "Settings";
- private static final String SVC_Result = "Result";
-
- @SuppressWarnings("unused")
- private static final String EMPTY_JSON_OBJECT = "{\n}\n";
-
- private static final String APPLICATION_JSON = "application/json";
-
- // Normally these would be in a database
- private static String TEST_KEY = "42";
- private static String TEST_SECRET = "zaphod";
-
- // Pretending to be a database row :)
- private static Map PERSIST = new TreeMap ();
-
- @Override
- public void init(ServletConfig config) throws ServletException {
- super.init(config);
- }
-
- protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- doPost(request,response);
- }
-
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- doPost(request,response);
- }
-
- protected void doPost(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException
- {
- try {
- doRequest(request, response);
- } catch (Exception e) {
- String ipAddress = request.getRemoteAddr();
- String uri = request.getRequestURI();
- M_log.log(Level.WARNING, "General LTI2 Failure URI="+uri+" IP=" + ipAddress);
- e.printStackTrace();
- response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- doErrorJSON(request, response, null, "General failure", e);
- }
- }
-
- @SuppressWarnings("unused")
- protected void doRequest(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException
- {
- System.out.println("getServiceURL="+getServiceURL(request));
-
- String ipAddress = request.getRemoteAddr();
- System.out.println("LTI Service request from IP=" + ipAddress);
-
- String rpi = request.getPathInfo();
- String uri = request.getRequestURI();
- String [] parts = uri.split("/");
- if ( parts.length < 4 ) {
- response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
- doErrorJSON(request, response, null, "Incorrect url format", null);
- return;
- }
- String controller = parts[3];
- if ( "register".equals(controller) ) {
- doRegister(request,response);
- return;
- } else if ( "launch".equals(controller) ) {
- doLaunch(request,response);
- return;
- } else if ( SVC_tc_profile.equals(controller) && parts.length == 5 ) {
- String profile_id = parts[4];
- getToolConsumerProfile(request,response,profile_id);
- return;
- } else if ( SVC_tc_registration.equals(controller) && parts.length == 5 ) {
- String profile_id = parts[4];
- registerToolProviderProfile(request, response, profile_id);
- return;
- } else if ( SVC_Result.equals(controller) && parts.length == 5 ) {
- String sourcedid = parts[4];
- handleResultRequest(request, response, sourcedid);
- return;
- } else if ( SVC_Settings.equals(controller) && parts.length >= 6 ) {
- handleSettingsRequest(request, response, parts);
- return;
- }
-
- IMSJSONRequest jsonRequest = new IMSJSONRequest(request);
- if ( jsonRequest.valid ) {
- System.out.println(jsonRequest.getPostBody());
- }
-
- response.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED);
- M_log.log(Level.WARNING, "Unknown request="+uri);
- doErrorJSON(request, response, null, "Unknown request="+uri, null);
- }
-
- protected void doRegister(HttpServletRequest request, HttpServletResponse response)
- {
- // Reset our database
- PERSIST.clear();
- String launch_url = request.getParameter("launch_url");
- response.setContentType("text/html");
-
- String output = null;
- if ( launch_url != null ) {
- Properties ltiProps = new Properties();
-
- ltiProps.setProperty(BasicLTIConstants.LTI_VERSION, LTI2Constants.LTI2_VERSION_STRING);
- ltiProps.setProperty(LTI2Constants.REG_KEY,TEST_KEY);
- ltiProps.setProperty(LTI2Constants.REG_PASSWORD,TEST_SECRET);
- ltiProps.setProperty(BasicLTIUtil.BASICLTI_SUBMIT, "Press to Launch External Tool");
- ltiProps.setProperty(BasicLTIConstants.LTI_MESSAGE_TYPE, BasicLTIConstants.LTI_MESSAGE_TYPE_TOOLPROXYREGISTRATIONREQUEST);
-
- String serverUrl = getServiceURL(request);
- ltiProps.setProperty(LTI2Constants.TC_PROFILE_URL,serverUrl + SVC_tc_profile + "/" + TEST_KEY);
- ltiProps.setProperty(BasicLTIConstants.LAUNCH_PRESENTATION_RETURN_URL, serverUrl + "launch");
- System.out.println("ltiProps="+ltiProps);
-
- boolean dodebug = true;
- output = BasicLTIUtil.postLaunchHTML(ltiProps, launch_url, dodebug);
- } else {
- output = "