Change default value of userInfoUrl. Add redis configuration to ReadMe

This commit is contained in:
Konstantinos Triantafyllou 2021-12-08 13:57:39 +02:00
parent 0603002333
commit bde479b4ac
3 changed files with 11 additions and 8 deletions

View File

@ -10,7 +10,7 @@ a Redis http session.
In stateless strategy, there is not a session. A filter makes a request
to an "userinfo" endpoint and creates an Authentication base on the response.
The advantage of this method is that it doesn't need any storage to store
user's session, but with the cost of an extra http request per request.
user's session, but with a cost of an extra http request per request.
### Usage
@ -19,7 +19,7 @@ user's session, but with the cost of an extra http request per request.
<dependency>
<groupId>eu.dnetlib</groupId>
<artifactId>uoa-authorization-library</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>
</dependency>
#### Spring Application/Configuration
@ -35,8 +35,8 @@ user's session, but with the cost of an extra http request per request.
#### Configuration
authorization.security.userInfoUrl = http://<domain>/login-service/userInfo
authorization.security.session=openAIRESession # Default, do not change
authorization.security.userInfoUrl = http://<domain>/login-service/userInfo # Required, default ""
authorization.security.session=<session-cookie-name> # Default openAIRESession
## Redis
@ -52,7 +52,7 @@ where session is stored.
<dependency>
<groupId>eu.dnetlib</groupId>
<artifactId>uoa-authorization-library</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>
<classifier>redis</classifier>
</dependency>
@ -69,8 +69,11 @@ where session is stored.
#### Configuration
authorization.secuirty.redis.host=<redis-ip> # Default localhost
authorization.secuirty.redis.port=<redis-port> # Default 6379
authorization.secuirty.redis.password=<redis-password> # Default ""
authorization.security.domain=<domain-suffix> # e.g openaire.eu
authorization.security.session=openAIRESession # Default, do not change
authorization.security.session=<session-cookie-name> # Default openAIRESession
## Authorize Requests

View File

@ -27,7 +27,7 @@ public class AuthorizationUtils {
String url = securityConfig.getUserInfoUrl();
RestTemplate restTemplate = new RestTemplate();
try {
if(hasCookie(request)) {
if(url != null && hasCookie(request)) {
ResponseEntity<UserInfo> response = restTemplate.exchange(url, HttpMethod.GET, createHeaders(request), UserInfo.class);
return response.getBody();
}

View File

@ -1,6 +1,6 @@
#dev
spring.session.store-type=none
authorization.security.userInfoUrl = http://mpagasas.di.uoa.gr:8080/login-service/userInfo
authorization.security.userInfoUrl=
authorization.security.domain=di.uoa.gr
authorization.security.session=openAIRESession
authorization.globalVars.buildDate=@timestampAuthorizationLibrary@