Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lyo-dev] eclipse/Lyo Java Client API updates for release 4.0.0

Ralph,
You can do that. See:

   // IBM jazz-apps use JEE Form based authentication
                    clientBuilder.register(newJEEFormAuthenticator(webContextUrl, userId, password));

as an example.

Jim Amsden, Senior Technical Staff Member
OSLC and Linked Lifecycle Data
919-525-6575




From:        Ralph Schoon/Germany/IBM
To:        Jim Amsden/Raleigh/IBM@IBMUS
Cc:        "Lyo project developer discussions" <lyo-dev@xxxxxxxxxxx>, Nicholas Crossley/Seattle/Contr/IBM@IBMUS
Date:        02/13/2019 06:46 AM
Subject:        Re: eclipse/Lyo Java Client API updates for release 4.0.0



Hi Jim,

I would like to be able to at least register a request interceptor against the oslc client.
Is there a maven repository I could use to test a bit?

Mit freundlichen Grüßen / Kind regards
Ralph Schoon

"Unleash the Labs" - Watson IoT Connected Products
Leading Technical Sales Professional
Client Technical Specialist
Certified IT Specialist


E-Mail:ralph.schoon@xxxxxxxxxxIBM Deutschland
Mobile:+49-170-4532-366Wilhelm-Fay-Str. 30-34
65936 Frankfurt
Blog:http://rsjazz.wordpress.com/Germany

IBM Deutschland GmbH / Vorsitzender des Aufsichtsrats: Martin Jetter Geschaeftsfuehrung: Matthias Hartmann(Vorsitzender), Norbert Janzen, Nicole Reimer, Stefan Lutz, Wolfgang Wendt, Dr. Klaus Seifert Sitz der Gesellschaft: Ehningen / Registergericht: Amtsgericht Stuttgart, HRB 14562 WEEE-Reg.-Nr. DE 99369940





From:        Jim Amsden/Raleigh/IBM
To:        "Lyo project developer discussions" <lyo-dev@xxxxxxxxxxx>
Cc:        Nicholas Crossley/Seattle/Contr/IBM@IBMUS, Ralph Schoon/Germany/IBM@IBMDE
Date:        12.02.2019 21:46
Subject:        eclipse/Lyo Java Client API updates for release 4.0.0



Since Apache Wink has been retired, and the current oslc-java-client includes a large set of Wink jar files that bloat up client implementations, we decided to remove Wink from OSLC4J.

Unfortunately, for the Java client, that would result in some API breaking changes. So we decided to leave oslc-java-client alone - it and its sample applications are unchanged in 4.0.0, and still depend on Wink. As expected, this client works with servers that are implemented using Wink or Jersey, so there was no need to change it.

In addition, I created a new Java client, oslc4j-client that only depends on JAX-RS 2.0. This client does not reference any JAX-RS implementation, leaving the choice of the implementation up to the client applications. It also does not support SSL or any authentication, also leaving those specifics up to the client applications as needed. This radically simplifies the oslc4j-client, and reduces its size, while providing the flexibility client applications need to configure their client access.

The new OslcClient constructor can now take a single ClientBuilder argument. The client application creates and configures a ClientBuilder to meet their needs, and passes in the OslcClient(ClientBuilder) constructor for subsequent use.

I have also added Jazz rootservices discovery methods directly to OslcClient since these are often necessary to discover OSLC discovery URLs (and something we're considering adding to the OSLC standards).

As a result, there is no longer any need for OslcClient subclasses for rootservices processing, Jazz Form based authentication, etc.

Here's an example of how a client application would configure, create and use an OslcClient to access jazz-apps that use JEE Form based authentication, taken from the oslc4j-client-samples/IECMSample.java sample application. HTTP Basic, Digest, etc. can be handled similarly:

                        // STEP 1: Configure the ClientBuilder as needed for your client application
                       
                        // Use HttpClient instead of the default HttpUrlConnection
                        ClientConfig clientConfig= newClientConfig().connectorProvider(newApacheConnectorProvider());
                        ClientBuilder clientBuilder= ClientBuilder.newBuilder();
                        clientBuilder.withConfig(clientConfig);
                       
                        // Setup SSL support to ignore self-assigned SSL certificates
                    SSLContextBuilder sslContextBuilder= newSSLContextBuilder();
                    sslContextBuilder.loadTrustMaterial(TrustSelfSignedStrategy.INSTANCE);
                    clientBuilder.sslContext(sslContextBuilder.build());
                    clientBuilder.hostnameVerifier(NoopHostnameVerifier.INSTANCE);
                                       
                    // IBM jazz-apps use JEE Form based authentication
                    clientBuilder.register(newJEEFormAuthenticator(webContextUrl, userId, password));

                    // STEP 2: Create a new OslcClient using the above configuration
                        OslcClient client= newOslcClient(clientBuilder);

                        // STEP 3: Get the URL of the OSLC ChangeManagement service from the rootservicesdocument
                        String catalogUrl= client.getCatalogUrl(webContextUrl, OSLCConstants.OSLC_CM_V2);

                        // STEP 4: Find the OSLC Service Provider for the project area we want to work with
                        String serviceProviderUrl= client.lookupServiceProviderUrl(catalogUrl, projectArea);

JEE FormAuthenticator is included in oslc4j-client for convenience, and to provide an example for how other authentication filters could be developed.

Let me know if this is sufficient to meet you OSLC4J Java client needs as we are in the process of finishing up the 4.0.0 release.



Jim Amsden, Senior Technical Staff Member
OSLC and Linked Lifecycle Data
919-525-6575





Back to the top