Skip to content

lobtx/gru-library-identitystore

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library Identitystore

Introduction

This library provides services to communicate with Identity Store REST API.

Services

The main service is fr.paris.lutece.plugins.identitystore.web.service.IdentityService which provides methods to call Identity Store.

It requires an implementation of fr.paris.lutece.plugins.identitystore.web.service.IIdentityTransportProvider to define the HTTP transport. Two implementations of this interface are provided in the library :

  • fr.paris.lutece.plugins.identitystore.web.rs.service.IdentityTransportApiManagerRest , which uses ApiManager WSO2 in order to secure requests to the API (by using tokens)
  • fr.paris.lutece.plugins.identitystore.web.rs.service.IdentityTransportRest , which uses simple requests

Both implementations require URL definition of the Identity Store service end point. This URL is stored in the attribute identityStoreEndPoint . The IdentityTransportApiManagerRest implementation requires extra properties.

Configuration using Spring context

First, define the bean for the HTTP transport you want to use:

  • set the property for the URL of the Identity Store service end point
  • set other properties if using the HTTP transport IdentityTransportApiManagerRest

Then, define the bean for the service IdentityService :

  • as a constructor argument, refer to the bean for HTTP transport

Here is an example of Spring configuration with the HTTP transport IdentityTransportRest :


<bean id="lib-identitystore.simpleTransport" class="fr.paris.lutece.plugins.identitystore.web.rs.service.IdentityTransportRest">
    <property name="IdentityStoreEndPoint">
        <value>http://mydomain.com/url/to/identitystore</value>
    </property>
</bean>
<bean id="lib-identitystore.identityService" class="fr.paris.lutece.plugins.identitystore.web.service.IdentityService">
    <constructor-arg ref="lib-identitystore.simpleTransport"/>
</bean>
                        

Here is an example of Spring configuration with the HTTP transport IdentityTransportApiManagerRest :


<bean id="lib-identitystore.apiManagerTransport" class="fr.paris.lutece.plugins.identitystore.web.rs.service.IdentityTransportApiManagerRest">
    <property name="identityStoreEndPoint">
        <value>http://mydomain.com/url/to/apimanager/api/identitystore</value>
    </property>
    <property name="apiManagerEndPoint">
        <value>http://mydomain.com/url/to/apimanager/token</value>
    </property>
    <property name="apiManagerCredentials">
        <value>your_private_key</value>
    </property>
</bean>
<bean id="lib-identitystore.identityService" class="fr.paris.lutece.plugins.identitystore.web.service.IdentityService">
    <constructor-arg ref="lib-identitystore.apiManagerTransport"/>
</bean>
                        

Configuration in Java code

The service can directly be created in the Java code. Here is an example with the HTTP transport IdentityTransportApiManagerRest (the same mechanism can be applied for the HTTP transport IdentityTransportRest ).

First, define the following keys in a properties file:


myplugin.endpoint.identitystore=http://mydomain.com/url/to/apimanager/api/identitystore
myplugin.endpoint.token=http://mydomain.com/url/to/apimanager/token
myplugin.apimanager.credentials=your_private_key
                        

Then, add the following code in the Java code:


private static final String PROPERTY_ENDPOINT_IDENTITYSTORE = "myplugin.endpoint.identitystore";
private static final String PROPERTY_ENDPOINT_TOKEN = "myplugin.endpoint.token";
private static final String PROPERTY_APIMANAGER_CREDENTIALS = "myplugin.apimanager.credentials";
...
IdentityTransportApiManagerRest apiManagerTransport = new IdentityTransportApiManagerRest(  );
apiManagerTransport.setIdentityStoreEndPoint( AppPropertiesService.getProperty( PROPERTY_ENDPOINT_IDENTITYSTORE ) );
apiManagerTransport.setApiManagerEndPoint( AppPropertiesService.getProperty( PROPERTY_ENDPOINT_TOKEN ) );
apiManagerTransport.setApiManagerCredentials( AppPropertiesService.getProperty( PROPERTY_APIMANAGER_CREDENTIALS ) );

IdentityService identityService = new IdentityService( apiManagerTransport );
                        

Maven documentation and reports

generated by xdoc2md - do not edit directly.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%