Skip to content

Commit 0ecfba9

Browse files
author
TanyaEf
committed
Updated ReadMe (Authentication and Logging sections)
1 parent a325ded commit 0ecfba9

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

README.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ Table of Contents
112112
17. [Asynchronous API](#asynchronous-api).
113113
18. [Getting serialized content from response](#getting-serialized-content-from-response).
114114
19. [Switching between JSON and XML](#switching-between-json-and-xml).
115-
20. [Possible issues](#possible-issues).
116-
21. [Maven dependency to add jasperserver-rest-client to your app](#maven-dependency-to-add-jasperserver-rest-client-to-your-app).
117-
22. [License](#license).
115+
20. [Logging](#logging).
116+
21. [Possible issues](#possible-issues).
117+
22. [Maven dependency to add jasperserver-rest-client to your app](#maven-dependency-to-add-jasperserver-rest-client-to-your-app).
118+
23. [License](#license).
118119

119120
Introduction
120121
-------------
@@ -164,6 +165,16 @@ Session session = client.authenticate("jasperadmin", "jasperadmin");
164165
//authentication with multitenancy enabled
165166
Session session = client.authenticate("jasperadmin|organization_1", "jasperadmin");
166167
```
168+
`JasperserverRestClient` supports three authentication types: REST, SPRING and BASIC.
169+
`REST` type of authentication means that your credentials are sent through `/rest/login`, and in the `SPRING` mode – through `/j_security_check directly/`. Using these types you obtain JSESSIONID cookie of authenticated session after sending credentials.
170+
In the `BASIC` mode `JasperserverRestClient` uses basic authentication (sends encrypted credentials with each request).
171+
Client uses `REST` authentication by default but you can change the mode using follow code:
172+
```java
173+
config.setAuthenticationType(AuthenticationType.SPRING);
174+
```
175+
Or specify authentication type in RestClientConfiguration instance (for details, read section [Configuration](https://github.com/Jaspersoft/jrs-rest-java-client/blob/master/README.md#configuration).
176+
Please notice, the basic authentication is not stateless and it is valid till method logout() is called or the application is restarted.
177+
167178
####Invalidating session
168179
Not to store session on server you can invalidate it with `logout()` method.
169180
```java
@@ -813,7 +824,7 @@ Response response = operationResult.getResponse();
813824
```
814825
####Setting Role Membership
815826
To assign role membership to a user, set the roles property on the user account with the PUT method of the rest_
816-
v2/users service. For details, see section [creating a user](https://github.com/boryskolesnykov/jasperserver-rest-client/edit/master/README.md#creating-a-user).
827+
v2/users service. For details, see section [creating a user](https://github.com/Jaspersoft/jrs-rest-java-client/blob/master/README.md#creating-a-user).
817828
####Deleting a Role
818829
To delete a role, send the DELETE method and specify the role ID (name) in the URL.
819830
When this method is successful, the role is permanently deleted.
@@ -905,7 +916,7 @@ There are two operations on file resources:
905916
* Viewing the file resource details to determine the file format
906917
* Downloading the binary file contents
907918

908-
To view the file resource details, specify the URL of the file in `resource()` method and use the code form [Viewing Resource Details](https://github.com/boryskolesnykov/jasperserver-rest-client/edit/master/README.md#viewing-resource-details) section.
919+
To view the file resource details, specify the URL of the file in `resource()` method and use the code form [Viewing Resource Details](https://github.com/Jaspersoft/jrs-rest-java-client/blob/master/README.md#viewing-resource-details) section.
909920
To download file binary content, specify the URL of the file in `resource()` method and use the code below
910921
```java
911922
OperationResult<InputStream> result = client
@@ -1546,6 +1557,16 @@ acceptMimeType=JSON
15461557
RestClientConfiguration configuration = RestClientConfiguration.loadConfiguration("jrs-client-config.properties");
15471558
```
15481559

1560+
###Logging
1561+
It is possible to log outgoing requests and incoming responses using `logHttp` property of `RestCleintConfiguration`:
1562+
```java
1563+
config.setLogHttp(true);
1564+
```
1565+
Also, you are able to log entities using `logHttpEntity` option:
1566+
```java
1567+
config.setLogHttpEntity(true).
1568+
```
1569+
15491570
###Possible issues
15501571
1. <strong>Deploying jrs-rest-client within web app to any Appplication Server, e.g. JBoss, Glassfish, WebSphere etc.</strong>
15511572
jrs-rest-client uses the implementation of JAX-RS API of version 2.0 and if your application server does not support this version you will get an error. To solve this problem you need to add to your application a deployment configuration specific for your AS where you need to exclude modules with old JAX-RS API version. Example of such descriptor for JBoss AS you can find below:

0 commit comments

Comments
 (0)