summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Padgett2012-01-19 13:19:18 (EST)
committer Michael Fiedler2012-01-20 08:54:10 (EST)
commitddb5b4af044a7438f4fc48e1e0b2b120086939aa (patch)
tree937090d2990fcdf653df871c34289316adab4813
parentdd576f91a1b27b827c170629b08497ae37bb8f83 (diff)
downloadorg.eclipse.lyo.server-ddb5b4af044a7438f4fc48e1e0b2b120086939aa.zip
org.eclipse.lyo.server-ddb5b4af044a7438f4fc48e1e0b2b120086939aa.tar.gz
org.eclipse.lyo.server-ddb5b4af044a7438f4fc48e1e0b2b120086939aa.tar.bz2
Bug 360178 - [Bugzilla] Add support for OAuth
Adds OAuth support for the sample Bugzilla OSLC provider using the OAuth framework from Bug 368872. See <https://bugs.eclipse.org/bugs/show_bug.cgi?id=368872>.
-rw-r--r--org.eclipse.lyo.samples.bugzilla/.gitignore1
-rw-r--r--org.eclipse.lyo.samples.bugzilla/pom.xml15
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/BugzillaInitializer.java137
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java4
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestService.java4
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/BugzillaOAuthException.java29
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/RestException.java14
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/UnauthroziedException.java6
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/utils/HttpUtils.java30
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/webapp/WEB-INF/web.xml182
-rw-r--r--org.eclipse.lyo.samples.bugzilla/src/main/webapp/cm/rootservices_rdfxml.jsp14
11 files changed, 326 insertions, 110 deletions
diff --git a/org.eclipse.lyo.samples.bugzilla/.gitignore b/org.eclipse.lyo.samples.bugzilla/.gitignore
new file mode 100644
index 0000000..eb5a316
--- /dev/null
+++ b/org.eclipse.lyo.samples.bugzilla/.gitignore
@@ -0,0 +1 @@
+target
diff --git a/org.eclipse.lyo.samples.bugzilla/pom.xml b/org.eclipse.lyo.samples.bugzilla/pom.xml
index 10d8ea4..d70dba5 100644
--- a/org.eclipse.lyo.samples.bugzilla/pom.xml
+++ b/org.eclipse.lyo.samples.bugzilla/pom.xml
@@ -74,7 +74,20 @@
<artifactId>j2bugzilla</artifactId>
<version>1.0</version>
</dependency>
-
+
+ <dependency>
+ <groupId>org.eclipse.lyo.server</groupId>
+ <artifactId>oauth-webapp</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <type>war</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.lyo.server</groupId>
+ <artifactId>oauth-core</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+
</dependencies>
<build>
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/BugzillaInitializer.java b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/BugzillaInitializer.java
index 4d492c7..2436950 100644
--- a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/BugzillaInitializer.java
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/BugzillaInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation.
+ * Copyright (c) 2011, 2012 IBM Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -17,26 +17,127 @@
package org.eclipse.lyo.samples.bugzilla;
import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
import java.util.Properties;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
+import net.oauth.OAuth;
+import net.oauth.OAuthException;
+import net.oauth.OAuthMessage;
+import net.oauth.OAuthProblemException;
+import net.oauth.server.OAuthServlet;
+
+import org.eclipse.lyo.samples.bugzilla.exception.BugzillaOAuthException;
import org.eclipse.lyo.samples.bugzilla.exception.UnauthroziedException;
import org.eclipse.lyo.samples.bugzilla.utils.HttpUtils;
+import org.eclipse.lyo.server.oauth.core.Authentication;
+import org.eclipse.lyo.server.oauth.core.AuthenticationException;
+import org.eclipse.lyo.server.oauth.core.OAuthConfiguration;
+import org.eclipse.lyo.server.oauth.core.OAuthRequest;
+import org.eclipse.lyo.server.oauth.core.consumer.ConsumerStore;
+import org.eclipse.lyo.server.oauth.core.consumer.LyoOAuthConsumer;
+import org.eclipse.lyo.server.oauth.core.token.LRUCache;
+import org.eclipse.lyo.server.oauth.core.token.SimpleTokenStrategy;
import com.j2bugzilla.base.BugzillaConnector;
import com.j2bugzilla.base.BugzillaException;
import com.j2bugzilla.base.ConnectionException;
import com.j2bugzilla.rpc.LogIn;
-public class BugzillaInitializer {
+public class BugzillaInitializer implements ServletContextListener {
- private static final String CONNECTOR_SESSION_ATTRIBUTE = "org.eclipse.lyo.samples.bugzilla.BugzillaConnector";
+ private static final String CONNECTOR_ATTRIBUTE = "org.eclipse.lyo.samples.bugzilla.BugzillaConnector";
private static String baseUri = null;
private static String bugzillaUri = null;
- private static boolean provideHtml = true;
-
+ private static boolean provideHtml = true;
+
+ /*
+ * We can't rely on session tracking always working for OAuth requests, so store the BugzillaConnector in a map
+ * with the OAuth token as the key.
+ */
+ private static LRUCache<String, BugzillaConnector> keyToConnectorCache = new LRUCache<String, BugzillaConnector>(
+ 200);
+
+ @Override
+ public void contextInitialized(ServletContextEvent event) {
+ OAuthConfiguration config = OAuthConfiguration.getInstance();
+
+ // The realm used in 401 unauthorized responses.
+ config.setRealm("Bugzilla");
+
+ // Validates a user's ID and password.
+ config.setAuthentication(new Authentication() {
+ @Override
+ public void login(HttpServletRequest request, String id,
+ String password) throws AuthenticationException {
+ try {
+ BugzillaConnector bc = new BugzillaConnector();
+ bc.connectTo(bugzillaUri + "/xmlrpc.cgi");
+ LogIn login = new LogIn(id, password);
+ bc.executeMethod(login);
+ request.setAttribute(CONNECTOR_ATTRIBUTE, bc);
+ } catch (Exception e) {
+ throw new AuthenticationException(e.getCause().getMessage(), e);
+ }
+ }
+
+ @Override
+ public String getApplicationName() {
+ // Display name for this application.
+ return "Bugzilla";
+ }
+ });
+
+ /*
+ * Override some SimpleTokenStrategy methods so that we can keep the
+ * BugzillaConnection associated with the OAuth tokens.
+ */
+ config.setTokenStrategy(new SimpleTokenStrategy() {
+ @Override
+ public void markRequestTokenAuthorized(
+ HttpServletRequest httpRequest, String requestToken)
+ throws OAuthProblemException {
+ keyToConnectorCache.put(requestToken,
+ (BugzillaConnector) httpRequest.getAttribute(CONNECTOR_ATTRIBUTE));
+ super.markRequestTokenAuthorized(httpRequest, requestToken);
+ }
+
+ @Override
+ public void generateAccessToken(OAuthRequest oAuthRequest)
+ throws OAuthProblemException, IOException {
+ String requestToken = oAuthRequest.getMessage().getToken();
+ BugzillaConnector bc = keyToConnectorCache.remove(requestToken);
+ super.generateAccessToken(oAuthRequest);
+ keyToConnectorCache.put(oAuthRequest.getAccessor().accessToken, bc);
+ }
+ });
+
+ try {
+ // For now, hard-code the consumers.
+ config.setConsumerStore(new ConsumerStore() {
+ @Override
+ public Collection<LyoOAuthConsumer> load() throws IOException {
+ // Define one consumer with key "key" and secret "secret".
+ LyoOAuthConsumer consumer = new LyoOAuthConsumer("rtc", "sesame");
+ consumer.setName("Rational Team Concert");
+ return Collections.singletonList(consumer);
+ }
+ });
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent event) {
+ }
+
static {
Properties props = new Properties();
try {
@@ -70,17 +171,37 @@ public class BugzillaInitializer {
public static BugzillaConnector getBugzillaConnector(
HttpServletRequest request) throws ConnectionException,
- UnauthroziedException {
+ UnauthroziedException, IOException, ServletException {
+ // First check if this is an OAuth request.
+ try {
+ OAuthMessage message = OAuthServlet.getMessage(request, null);
+ if (message.getToken() != null) {
+ OAuthRequest oAuthRequest = new OAuthRequest(request);
+ oAuthRequest.validate();
+ BugzillaConnector connector = keyToConnectorCache.get(message
+ .getToken());
+ if (connector == null) {
+ throw new OAuthProblemException(
+ OAuth.Problems.TOKEN_EXPIRED);
+ }
+
+ return connector;
+ }
+ } catch (OAuthException e) {
+ throw new BugzillaOAuthException(e);
+ }
+
+ // This is not an OAuth request. Check for basic access authentication.
HttpSession session = request.getSession();
BugzillaConnector connector = (BugzillaConnector) session
- .getAttribute(CONNECTOR_SESSION_ATTRIBUTE);
+ .getAttribute(CONNECTOR_ATTRIBUTE);
if (connector == null) {
Credentials credentials = HttpUtils.getCredentials(request);
if (credentials == null) {
throw new UnauthroziedException();
}
connector = getBugzillaConnector(credentials);
- session.setAttribute(CONNECTOR_SESSION_ATTRIBUTE, connector);
+ session.setAttribute(CONNECTOR_ATTRIBUTE, connector);
}
return connector;
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java
index d6bcaa3..ee71385 100644
--- a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestCollectionService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation.
+ * Copyright (c) 2011, 2012 IBM Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -95,7 +95,7 @@ public class ChangeRequestCollectionService extends HttpServlet {
HttpServletResponse response,
Collection<BugzillaChangeRequest> changeRequests)
throws ConnectionException, BugzillaException,
- UnauthroziedException {
+ UnauthroziedException, IOException, ServletException {
BugzillaConnector bc = BugzillaInitializer
.getBugzillaConnector(request);
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestService.java b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestService.java
index f9f0c3b..f58a9bc 100644
--- a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestService.java
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/ChangeRequestService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation.
+ * Copyright (c) 2011, 2012 IBM Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -174,7 +174,7 @@ public class ChangeRequestService extends HttpServlet {
private void updateBug(HttpServletRequest request, BugzillaChangeRequest cr)
throws ConnectionException, BugzillaException,
- UnauthroziedException {
+ UnauthroziedException, IOException, ServletException {
BugzillaConnector bc = BugzillaInitializer.getBugzillaConnector(request);
// No built in field to hold external links. Just add the new link as a comment for now.
String comment = getLinksComment(cr);
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/BugzillaOAuthException.java b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/BugzillaOAuthException.java
new file mode 100644
index 0000000..0e17e62
--- /dev/null
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/BugzillaOAuthException.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.samples.bugzilla.exception;
+
+import net.oauth.OAuthException;
+
+/**
+ * A special unauthorized exception indicating an OAuth problem.
+ *
+ * @author Samuel Padgett <spadgett@us.ibm.com>
+ */
+public class BugzillaOAuthException extends UnauthroziedException {
+ public BugzillaOAuthException(OAuthException e) {
+ super(e);
+ }
+}
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/RestException.java b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/RestException.java
index 0e6f43d..5c9024f 100644
--- a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/RestException.java
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/RestException.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation.
+ * Copyright (c) 2011, 2012 IBM Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -15,6 +15,8 @@
*******************************************************************************/
package org.eclipse.lyo.samples.bugzilla.exception;
+import javax.servlet.http.HttpServletResponse;
+
/**
* Holds a status code and error message for an error response.
*
@@ -29,6 +31,16 @@ public class RestException extends Exception {
this.message = message;
}
+ public RestException(Throwable t) {
+ this(t, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+
+ public RestException(Throwable t, int statusCode) {
+ super(t);
+ this.message = t.getMessage();
+ this.statusCode = statusCode;
+ }
+
public int getStatusCode() {
return statusCode;
}
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/UnauthroziedException.java b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/UnauthroziedException.java
index 178f625..5822f36 100644
--- a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/UnauthroziedException.java
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/exception/UnauthroziedException.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation.
+ * Copyright (c) 2011, 2012 IBM Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -31,4 +31,8 @@ public class UnauthroziedException extends RestException {
public UnauthroziedException(String message) {
super(HttpServletResponse.SC_UNAUTHORIZED, message);
}
+
+ public UnauthroziedException(Throwable t) {
+ super(t, HttpServletResponse.SC_UNAUTHORIZED);
+ }
}
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/utils/HttpUtils.java b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/utils/HttpUtils.java
index 7c5d8d1..87f6f3c 100644
--- a/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/utils/HttpUtils.java
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/java/org/eclipse/lyo/samples/bugzilla/utils/HttpUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation.
+ * Copyright (c) 2011, 2012 IBM Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -18,15 +18,20 @@ package org.eclipse.lyo.samples.bugzilla.utils;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import net.oauth.server.OAuthServlet;
+
import org.apache.ws.commons.util.Base64;
import org.apache.ws.commons.util.Base64.DecodingException;
import org.eclipse.lyo.samples.bugzilla.Credentials;
+import org.eclipse.lyo.samples.bugzilla.exception.BugzillaOAuthException;
import org.eclipse.lyo.samples.bugzilla.exception.RestException;
import org.eclipse.lyo.samples.bugzilla.exception.UnauthroziedException;
import org.eclipse.lyo.samples.bugzilla.resources.Error;
+import org.eclipse.lyo.server.oauth.core.OAuthConfiguration;
/**
* Utilities for working with HTTP requests and responses.
@@ -38,9 +43,12 @@ public class HttpUtils {
public static final String AUTHORIZATION_HEADER = "Authorization";
public static final String WWW_AUTHENTICATE_HEADER = "WWW-Authenticate";
private static final String BASIC_AUTHORIZATION_PREFIX = "Basic ";
- private static final String WWW_AUTHENTICATE_HEADER_VALUE = BASIC_AUTHORIZATION_PREFIX
+ private static final String BASIC_AUTHENTICATION_CHALLENGE = BASIC_AUTHORIZATION_PREFIX
+ "realm=\"Bugzilla\"";
-
+ private static final String OAUTH_AUTHORIZATION_PREFIX = "OAuth ";
+ private static final String OAUTH_AUTHENTICATION_CHALLENGE = OAUTH_AUTHORIZATION_PREFIX
+ + "realm=\"Bugzilla\"";
+
/**
* Gets the credentials from an HTTP request.
*
@@ -85,10 +93,18 @@ public class HttpUtils {
}
public static void sendUnauthorizedResponse(HttpServletResponse response,
- UnauthroziedException e) throws IOException {
- response.setHeader(WWW_AUTHENTICATE_HEADER,
- WWW_AUTHENTICATE_HEADER_VALUE);
- sendErrorResponse(response, e);
+ UnauthroziedException e) throws IOException, ServletException {
+ if (e instanceof BugzillaOAuthException) {
+ OAuthServlet.handleException(response, e, OAuthConfiguration
+ .getInstance().getRealm());
+ } else {
+ // Accept basic access or OAuth authentication.
+ response.addHeader(WWW_AUTHENTICATE_HEADER,
+ OAUTH_AUTHENTICATION_CHALLENGE);
+ response.addHeader(WWW_AUTHENTICATE_HEADER,
+ BASIC_AUTHENTICATION_CHALLENGE);
+ sendErrorResponse(response, e);
+ }
}
private static void sendErrorResponse(HttpServletResponse response,
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/webapp/WEB-INF/web.xml b/org.eclipse.lyo.samples.bugzilla/src/main/webapp/WEB-INF/web.xml
index a355852..9c921ee 100644
--- a/org.eclipse.lyo.samples.bugzilla/src/main/webapp/WEB-INF/web.xml
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/webapp/WEB-INF/web.xml
@@ -1,84 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
- <display-name>OSLC Bugzilla Adapter</display-name>
- <servlet>
- <servlet-name>ServiceProviderCatalogService</servlet-name>
- <servlet-class>org.eclipse.lyo.samples.bugzilla.ServiceProviderCatalogService</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>ServiceProviderService</servlet-name>
- <servlet-class>org.eclipse.lyo.samples.bugzilla.ServiceProviderService</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>ChangeRequestService</servlet-name>
- <servlet-class>org.eclipse.lyo.samples.bugzilla.ChangeRequestService</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>ChangeRequestCollectionService</servlet-name>
- <servlet-class>org.eclipse.lyo.samples.bugzilla.ChangeRequestCollectionService</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>ChangeRequestCreatorService</servlet-name>
- <servlet-class>org.eclipse.lyo.samples.bugzilla.ChangeRequestCreatorService</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>ChangeRequestSelectorService</servlet-name>
- <servlet-class>org.eclipse.lyo.samples.bugzilla.ChangeRequestSelectorService</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>CreationShapeService</servlet-name>
- <servlet-class>org.eclipse.lyo.samples.bugzilla.CreationShapeService</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>QueryShapeService</servlet-name>
- <servlet-class>org.eclipse.lyo.samples.bugzilla.QueryShapeService</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>RootServicesService</servlet-name>
- <servlet-class>org.eclipse.lyo.samples.bugzilla.RootServicesService</servlet-class>
- </servlet>
- <servlet>
- <servlet-name>ConsumerKeyService</servlet-name>
- <servlet-class>org.eclipse.lyo.samples.bugzilla.ConsumerKeyService</servlet-class>
- </servlet>
- <servlet-mapping>
- <servlet-name>ServiceProviderCatalogService</servlet-name>
- <url-pattern>/catalog</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>ServiceProviderService</servlet-name>
- <url-pattern>/provider</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>ChangeRequestCollectionService</servlet-name>
- <url-pattern>/changerequests</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>ChangeRequestService</servlet-name>
- <url-pattern>/changerequest</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>ChangeRequestCreatorService</servlet-name>
- <url-pattern>/creator</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>ChangeRequestSelectorService</servlet-name>
- <url-pattern>/selector</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>CreationShapeService</servlet-name>
- <url-pattern>/creationshape</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>QueryShapeService</servlet-name>
- <url-pattern>/queryshape</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>RootServicesService</servlet-name>
- <url-pattern>/rootservices</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>ConsumerKeyService</servlet-name>
- <url-pattern>/consumer_key</url-pattern>
- </servlet-mapping>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ id="WebApp_ID" version="2.5">
+ <display-name>OSLC Bugzilla Adapter</display-name>
+ <servlet>
+ <servlet-name>ServiceProviderCatalogService</servlet-name>
+ <servlet-class>org.eclipse.lyo.samples.bugzilla.ServiceProviderCatalogService</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>ServiceProviderService</servlet-name>
+ <servlet-class>org.eclipse.lyo.samples.bugzilla.ServiceProviderService</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>ChangeRequestService</servlet-name>
+ <servlet-class>org.eclipse.lyo.samples.bugzilla.ChangeRequestService</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>ChangeRequestCollectionService</servlet-name>
+ <servlet-class>org.eclipse.lyo.samples.bugzilla.ChangeRequestCollectionService</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>ChangeRequestCreatorService</servlet-name>
+ <servlet-class>org.eclipse.lyo.samples.bugzilla.ChangeRequestCreatorService</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>ChangeRequestSelectorService</servlet-name>
+ <servlet-class>org.eclipse.lyo.samples.bugzilla.ChangeRequestSelectorService</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>CreationShapeService</servlet-name>
+ <servlet-class>org.eclipse.lyo.samples.bugzilla.CreationShapeService</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>QueryShapeService</servlet-name>
+ <servlet-class>org.eclipse.lyo.samples.bugzilla.QueryShapeService</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>RootServicesService</servlet-name>
+ <servlet-class>org.eclipse.lyo.samples.bugzilla.RootServicesService</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>ConsumerKeyService</servlet-name>
+ <servlet-class>org.eclipse.lyo.samples.bugzilla.ConsumerKeyService</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>JAX-RS Services</servlet-name>
+ <servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
+ <init-param>
+ <param-name>applicationConfigLocation</param-name>
+ <param-value>/WEB-INF/oauth-services</param-value>
+ </init-param>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>JAX-RS Services</servlet-name>
+ <url-pattern>/services/*</url-pattern>
+ </servlet-mapping>
+ <listener>
+ <listener-class>org.eclipse.lyo.samples.bugzilla.BugzillaInitializer</listener-class>
+ </listener>
+ <servlet-mapping>
+ <servlet-name>ServiceProviderCatalogService</servlet-name>
+ <url-pattern>/catalog</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>ServiceProviderService</servlet-name>
+ <url-pattern>/provider</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>ChangeRequestCollectionService</servlet-name>
+ <url-pattern>/changerequests</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>ChangeRequestService</servlet-name>
+ <url-pattern>/changerequest</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>ChangeRequestCreatorService</servlet-name>
+ <url-pattern>/creator</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>ChangeRequestSelectorService</servlet-name>
+ <url-pattern>/selector</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>CreationShapeService</servlet-name>
+ <url-pattern>/creationshape</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>QueryShapeService</servlet-name>
+ <url-pattern>/queryshape</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>RootServicesService</servlet-name>
+ <url-pattern>/rootservices</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>ConsumerKeyService</servlet-name>
+ <url-pattern>/consumer_key</url-pattern>
+ </servlet-mapping>
</web-app> \ No newline at end of file
diff --git a/org.eclipse.lyo.samples.bugzilla/src/main/webapp/cm/rootservices_rdfxml.jsp b/org.eclipse.lyo.samples.bugzilla/src/main/webapp/cm/rootservices_rdfxml.jsp
index 265c6a1..9194561 100644
--- a/org.eclipse.lyo.samples.bugzilla/src/main/webapp/cm/rootservices_rdfxml.jsp
+++ b/org.eclipse.lyo.samples.bugzilla/src/main/webapp/cm/rootservices_rdfxml.jsp
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<%--
- Copyright (c) 2011 IBM Corporation.
+ Copyright (c) 2011, 2012 IBM Corporation.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
@@ -14,7 +14,8 @@
IBM Corporation - initial API and implementation
--%>
-<%@ page contentType="application/rdf+xml" language="java"%>
+<%@ page contentType="application/rdf+xml" language="java" %>
+<%@ page pageEncoding="UTF-8" %>
<%
String baseUri = (String) request.getAttribute("baseUri");
%>
@@ -29,10 +30,11 @@ String baseUri = (String) request.getAttribute("baseUri");
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<dcterms:title>OSLC-CM Adapter/Bugzilla Jazz Root Services</dcterms:title>
- <oslc_cm:cmServiceProviders rdf:resource="<%= baseUri + "/catalog" %>" />
- <jfs:oauthAccessTokenUrl rdf:resource="<%= baseUri + "/access_token" %>" />
+ <oslc_cm:cmServiceProviders rdf:resource="<%= baseUri + "/catalog" %>" />
<jfs:oauthRealmName>Bugzilla</jfs:oauthRealmName>
<jfs:oauthDomain><%= baseUri %></jfs:oauthDomain>
- <jfs:oauthUserAuthorizationUrl rdf:resource="<%= baseUri + "/authorize" %>" />
- <jfs:oauthRequestConsumerKeyUrl rdf:resource="<%= baseUri + "/consumer_key" %>" />
+ <jfs:oauthRequestConsumerKeyUrl rdf:resource="<%= baseUri + "/consumer_key" %>" />
+ <jfs:oauthRequestTokenUrl rdf:resource="<%= baseUri + "/services/oauth/requestToken" %>"/>
+ <jfs:oauthUserAuthorizationUrl rdf:resource="<%= baseUri + "/services/oauth/authorize" %>" />
+ <jfs:oauthAccessTokenUrl rdf:resource="<%= baseUri + "/services/oauth/accessToken" %>"/>
</rdf:Description>