OAuth Client

TrueNTHConnect includes its own OAuth library to make communication with Shared Services easier and based on simple calls. These components were designed to provide a stable and uniform methodology for issuing requests and interpreting their outcomes, while observing our specific OAuth needs.

Additionally, the library was conceived as an independent project, not linked in anyway to the portal, in order to make it available to other projects to come.

This project was renamed and modularized as truenth-oauth-client

Root project 'truenth-oauth-client'
\--- Project ':modules'
     +--- Project ':modules:truenth-oauth-client-api' - TrueNTH OAuth client - API
     +--- Project ':modules:truenth-oauth-client-impl' - TrueNTH OAuth client - impl
     +--- Project ':modules:truenth-oauth-client-osgi-api' - TrueNTH OAuth client - OSGi API
     \--- Project ':modules:truenth-oauth-client-osgi-impl' - TrueNTH OAuth client - OSGi impl

OSGi jars are not required, but are made available for OSGi users.

Related links





Dependencies compile:
+--- javax.json:javax.json-api
\--- org.apache.httpcomponents:httpclient
     +--- org.apache.httpcomponents:httpcore
     +--- commons-logging:commons-logging
     \--- commons-codec:commons-codec



Dependencies compile:
+--- org.apache.httpcomponents:httpclient
|    +--- org.apache.httpcomponents:httpcore
|    +--- commons-logging:commons-logging
|    \--- commons-codec:commons-codec
+--- org.apache.httpcomponents:httpmime
|    \--- org.apache.httpcomponents:httpclient
\--- project :modules:truenth-oauth-client-api

How to use

1. Create a service

A client is the main object that will provide all OAuth services and centralize all necessary configuration.

The service class is named TrueNTHOAuthClient and the following example demonstrates how to create an instance using the staging server configuration to illustrate possible values.

TrueNTHOAuthClient client = TrueNTHOAuthClientBuilderFactory
                                .getTrueNTHOAuthClientBuilder( )

This is what this client can do for you:

public interface TrueNTHOAuthClient {

    TrueNTHAccessToken getAccessToken( String code ) throws IOException;

    String getAccessTokenEndpoint( );

    TrueNTHAccessToken getAccessTokenStatus( TrueNTHAccessToken accessToken ) throws IOException;

    String getAuthorizationUrl( List< NameValuePair > callbackParameters, List< NameValuePair > parameters );

    String getAuthorizationUrl( List< NameValuePair > callbackParameters );

    String getResource( String path, TrueNTHAccessToken accessToken ) throws IOException;

    SSDemographics getResourceDemographics( TrueNTHAccessToken accessToken ) throws IOException;

    JsonObject getResourceJson( String path, TrueNTHAccessToken accessToken ) throws IOException;

    String getResourceDemographicsUrl( );

    String getResourceUrl( String path );

    String getRolesUrl( long userId );

    List< SSRole > getTrueNTHRoles( long trueNTHUserId, TrueNTHAccessToken accessToken ) throws IOException;

    boolean hasScope( );

    boolean isAccessTokenActive( TrueNTHAccessToken accessToken ) throws IOException;

    void signRequest( TrueNTHAccessToken accessToken, HttpRequestBase request );

    String getAccessTokenStatusEndpoint( );

    String getApiKey( );

    String getApiSecret( );

    String getAuthorizationUrl( );

    String getCallback( );

    String getScope( );

    TrueNTHOAuthConfig getTrueNTHOAuthConfig( );

    String getVersion( );

cms truenth api uw