# DoorsOauthSample & Lyo 2.4 & DOORS 9.7 & Java 11

**URL:** <https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350>\
**Category:** Lyo\
**Created:** [February 6, 2020, 2:32am UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350 "2020-02-06T02:32:53Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![JankCode](https://forum.open-services.net/user_avatar/forum.open-services.net/jankcode/32/95_2.png) [@JankCode](https://forum.open-services.net/u/JankCode)\
**Post date:** [February 6, 2020, 2:32am UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350/1 "2020-02-06T02:32:53Z")

</div>

Changes:

1. Used Java 11,

2. Replaced wink with jersey  
RuntimeDelegate.setInstance(new org.glassfish.jersey.server.internal.RuntimeDelegateImpl());

3. get a _org.eclipse.lyo.client.oslc.OAuthRedirectException_ on step 3:

4. Console output:  
DEBUG [main] (DefaultRequestDirector.java:683) - Attempt 1 to execute request  
DEBUG [main] (DefaultClientConnection.java:268) - Sending request: GET /dwa/oauth-request-token?oauth\_consumer\_key=mykey&oauth\_signature\_method=HMAC-SHA1&oauth\_timestamp=1580955369&oauth\_nonce=194445792445900&oauth\_version=1.0&oauth\_signature=3NwKSQ4u%2BRYapf4pARTu%2BsBZnf8%3D HTTP/1.1  
DEBUG [main] (DefaultClientConnection.java:272) - \>\> GET /dwa/oauth-request-token?oauth\_consumer\_key=mykey&oauth\_signature\_method=HMAC-SHA1&oauth\_timestamp=1580955369&oauth\_nonce=194445792445900&oauth\_version=1.0&oauth\_signature=3NwKSQ4u%2BRYapf4pARTu%2BsBZnf8%3D HTTP/1.1  
DEBUG [main] (DefaultClientConnection.java:275) - \>\> Host: myhostname:8080  
DEBUG [main] (DefaultClientConnection.java:275) - \>\> Connection: Keep-Alive  
DEBUG [main] (DefaultClientConnection.java:275) - \>\> User-Agent: Apache-HttpClient/4.5 (Java/11.0.5)  
DEBUG [main] (DefaultClientConnection.java:275) - \>\> Cookie: JSESSIONID=146242D83C718BFD0D14E5B46B6F8DBE  
DEBUG [main] (DefaultClientConnection.java:253) - Receiving response: HTTP/1.1 200  
DEBUG [main] (DefaultClientConnection.java:256) - \<\< HTTP/1.1 200  
DEBUG [main] (DefaultClientConnection.java:259) - \<\< Content-Type: application/x-www-form-urlencoded;charset=ISO-8859-1  
DEBUG [main] (DefaultClientConnection.java:259) - \<\< Transfer-Encoding: chunked  
DEBUG [main] (DefaultClientConnection.java:259) - \<\< Date: Thu, 06 Feb 2020 02:16:09 GMT  
DEBUG [main] (DefaultRequestDirector.java:510) - Connection can be kept alive indefinitely  
DEBUG [main] (ThreadSafeClientConnManager.java:280) - Released connection is reusable.  
DEBUG [main] (ConnPoolByRoute.java:429) - Releasing connection [{}-\>WebURL//myhostname:8080][null]  
DEBUG [main] (ConnPoolByRoute.java:455) - Pooling connection [{}-\>WebURL//myhostname:8080][null]; keep alive indefinitely  
DEBUG [main] (ConnPoolByRoute.java:676) - Notifying no-one, there are no waiting threads  
Enter this URL in a browser and run again: WebURL//myhostname:8080/dwa/oauth-authorize-token?oauth\_token=6d934153-d152-4942-a378-32c9f1549305  
Feb 05, 2020 7:16:09 PM org.eclipse.lyo.client.oslc.samples.DoorsOauthSample main  
SEVERE: null  
org.eclipse.lyo.client.oslc.OAuthRedirectException  
at org.eclipse.lyo.client.oslc.OslcOAuthClient.getResourceInternal(OslcOAuthClient.java:191)  
at org.eclipse.lyo.client.oslc.OslcOAuthClient.getResourceInternal(OslcOAuthClient.java:208)  
at org.eclipse.lyo.client.oslc.OslcOAuthClient.getAuthorizationHeader(OslcOAuthClient.java:155)  
at org.eclipse.lyo.client.oslc.OslcOAuthClient.getResource(OslcOAuthClient.java:115)  
at org.eclipse.lyo.client.oslc.OslcClient.getResource(OslcClient.java:204)  
at org.eclipse.lyo.client.oslc.samples.DoorsOauthSample.main(DoorsOauthSample.java:151)

---

<div class="post-metadata">

**Author:** ![andrew](https://forum.open-services.net/user_avatar/forum.open-services.net/andrew/32/28_2.png) [@andrew](https://forum.open-services.net/u/andrew)\
**Post date:** [February 12, 2020, 8:52am UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350/2 "2020-02-12T08:52:28Z")

</div>

Hello and welcome to the OSLC forum!

@jamsden has experience with that sample. Before we start debugging, did you read [https://www.eclipse.org/forums/index.php/t/1065558/](https://www.eclipse.org/forums/index.php/t/1065558/)? In other words, do you go to the URL in the myhostname:8080/dwa/oauth-authorize-token?oauth\_token=6d934153-d152-4942-a378-32c9f1549305 and _still_ get the exception after re-running?

If you wish to have an app that does not require restart during the OAuth “dance”, please see [https://github.com/OSLC/lyo-samples/tree/master/client-oauth-discovery-dui](https://github.com/OSLC/lyo-samples/tree/master/client-oauth-discovery-dui) from @jad.

---

<div class="post-metadata">

**Author:** ![JankCode](https://forum.open-services.net/user_avatar/forum.open-services.net/jankcode/32/95_2.png) [@JankCode](https://forum.open-services.net/u/JankCode)\
**Post date:** [February 13, 2020, 1:37am UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350/3 "2020-02-13T01:37:09Z")

</div>

_still_ get the exception after re-running? **Yes.**

Looked at “[lyo-samples/client-oauth-discovery-dui at master · OSLC/lyo-samples · GitHub](https://github.com/OSLC/lyo-samples/tree/master/client-oauth-discovery-dui)” and its a Web Application. So, I would replace how we create a OslcOAuthClient (using _helper_) with using the factory?

> OslcOAuthClientBuilder oAuthClientBuilder = OslcClientFactory.oslcOAuthClientBuilder();  
> oAuthClientBuilder.setFromRootService(rootService);  
> oAuthClientBuilder.setOAuthConsumer(“”, consumerKey, consumerSecret);  
> oAuthClientBuilder.setClientBuilder(clientBuilder);  
> oAuthClientBuilder.setUnderlyingHttpClient(new UnderlyingHttpClient() {  
> @Override  
> public HttpClient get(Client client) {  
> return ApacheConnectorProvider.getHttpClient(client);  
> }  
> });  
> client = (OslcOAuthClient) oAuthClientBuilder.build();  
> bindClientToSession(httpServletRequest, client, consumerKey);

Additionally, DOORS classic 9.7 with DOORS Web Access DWA only supports Oauth 1.0 & 1.0a. Does your client code support these versions?

---

<div class="post-metadata">

**Author:** ![JankCode](https://forum.open-services.net/user_avatar/forum.open-services.net/jankcode/32/95_2.png) [@JankCode](https://forum.open-services.net/u/JankCode)\
**Post date:** [February 13, 2020, 1:37am UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350/4 "2020-02-13T01:37:56Z")

</div>

PS thanks for the help 😃

---

<div class="post-metadata">

**Author:** ![jad](https://forum.open-services.net/user_avatar/forum.open-services.net/jad/32/42_2.png) [@jad](https://forum.open-services.net/u/jad)\
**Post date:** [February 13, 2020, 10:55pm UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350/5 "2020-02-13T22:55:48Z")

</div>

Hi

> So, I would replace how we create a OslcOAuthClient (using _helper_ ) with using the factory?

Yes! But please note that the OslcClientFactory is the new OSLC client (Lyo 4.0) for Jersey. I believe the DoorsOauthSample code you were looking at is based on Lyo 2.4 (and hence Wink)

> Additionally, DOORS classic 9.7 with DOORS Web Access DWA only supports Oauth 1.0 & 1.0a. Does your client code support these versions?

The sample code does support Oauth 1.0 (But I am not exactly sure if it support both 1.0 and 1.0a, but at least one of them for sure.)

---

<div class="post-metadata">

**Author:** ![JankCode](https://forum.open-services.net/user_avatar/forum.open-services.net/jankcode/32/95_2.png) [@JankCode](https://forum.open-services.net/u/JankCode)\
**Post date:** [February 14, 2020, 1:14am UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350/6 "2020-02-14T01:14:29Z")

</div>

I tried to build/run [lyo-samples/client-oauth-discovery-dui at master · OSLC/lyo-samples · GitHub](https://github.com/OSLC/lyo-samples/tree/master/client-oauth-discovery-dui) and got:

> Blockquote Could not find artifact org.eclipse.lyo.clients:oslc4j-client:jar:2.4.0

The pom sets:

> Blockquote \<version.lyo\>4.0.0-SNAPSHOT\</version.lyo\>

So, not sure why the project is looking for 2.4.0?

---

<div class="post-metadata">

**Author:** ![JankCode](https://forum.open-services.net/user_avatar/forum.open-services.net/jankcode/32/95_2.png) [@JankCode](https://forum.open-services.net/u/JankCode)\
**Post date:** [February 18, 2020, 12:48am UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350/7 "2020-02-18T00:48:48Z")

</div>

The end of the URL needs a “/”

Bad:

> -url [http://doorshostname](http://doorshostname):port#/dwa -user username -password password -project module\_name

Good:

> -url [http://doorshostname](http://doorshostname):port#/dwa/ -user username -password password -project module\_name

---

<div class="post-metadata">

**Author:** ![andrew](https://forum.open-services.net/user_avatar/forum.open-services.net/andrew/32/28_2.png) [@andrew](https://forum.open-services.net/u/andrew)\
**Post date:** [February 18, 2020, 6:46pm UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350/8 "2020-02-18T18:46:26Z")

</div>

Hi,

I cannot reproduce your error with the 2.4.0 deps:

 ![image](https://forum.open-services.net/uploads/default/original/1X/fbfc51b5c543d336fd7375bcf57364fa1e44e36d.png)

Thanks for reporting the tip with the URL, which README should I add it to?

---

<div class="post-metadata">

**Author:** ![jad](https://forum.open-services.net/user_avatar/forum.open-services.net/jad/32/42_2.png) [@jad](https://forum.open-services.net/u/jad)\
**Post date:** [February 20, 2020, 8:13am UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350/9 "2020-02-20T08:13:28Z")

</div>

I just tried and cannot reproduce the 2.4.0 deps error either.

---

<div class="post-metadata">

**Author:** ![JankCode](https://forum.open-services.net/user_avatar/forum.open-services.net/jankcode/32/95_2.png) [@JankCode](https://forum.open-services.net/u/JankCode)\
**Post date:** [February 20, 2020, 7:29pm UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350/10 "2020-02-20T19:29:49Z")

</div>

> [@JankCode](#):
>
> org.eclipse.lyo.clients:oslc4j-client:jar:2.4.0

The Project calls out two REPOs and I do not see org.eclipse.lyo.clients:oslc4j-client:jar:2.4.0?  
Do you have a local REPO in your setting.xml or have the jar in your local .m2?

 ![image](https://forum.open-services.net/uploads/default/original/1X/2c7a9644d6abfd2ba7d66fa3be67382c7d4b6469.png)

 ![image](https://forum.open-services.net/uploads/default/original/1X/8c128ab81ffbc776278222b065de6e0a33e107d6.png)

---

<div class="post-metadata">

**Author:** ![andrew](https://forum.open-services.net/user_avatar/forum.open-services.net/andrew/32/28_2.png) [@andrew](https://forum.open-services.net/u/andrew)\
**Post date:** [February 20, 2020, 8:32pm UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350/11 "2020-02-20T20:32:41Z")

</div>

First, _you should not need the 2.4.0 client_ to run the oAuth discovery app.

Second, before 4.0.0 the client was called `oslc-java-client`. See [https://oslc.github.io/developing-oslc-applications/eclipse\_lyo/setup-an-oslc-provider-consumer-application.html](https://oslc.github.io/developing-oslc-applications/eclipse_lyo/setup-an-oslc-provider-consumer-application.html) for more info.

---

<div class="post-metadata">

**Author:** ![JankCode](https://forum.open-services.net/user_avatar/forum.open-services.net/jankcode/32/95_2.png) [@JankCode](https://forum.open-services.net/u/JankCode)\
**Post date:** [February 26, 2020, 9:23pm UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350/12 "2020-02-26T21:23:52Z")

</div>

Thanks for the help everyone. 😀 So, if I am accessing IBM DOORS, as a OAuth 1.0a client, using the example provided. I should use the Lyo “classic” _oslc-java-client:2.4.0_? Right? Any plans to re-write the _org.eclipse.lyo.client.oslc.samples.DoorsOauthSample_ for _oslc4j-client:4.0.0.M1_ ?

---

<div class="post-metadata">

**Author:** ![andrew](https://forum.open-services.net/user_avatar/forum.open-services.net/andrew/32/28_2.png) [@andrew](https://forum.open-services.net/u/andrew)\
**Post date:** [March 6, 2020, 11:27am UTC](https://forum.open-services.net/t/doorsoauthsample-lyo-2-4-doors-9-7-java-11/350/13 "2020-03-06T11:27:44Z")

</div>

No plan to rewrite for now, you and @jamsden are the most likely people to make a PR for its support 🙂
