Removed unnecessary caches and methods in the authentication interface.
Change-Id: I274b3df6ef5c388dc534c4da8c6fa2fc7ccf3482
diff --git a/full/src/main/java/de/ids_mannheim/korap/authentication/APIAuthentication.java b/full/src/main/java/de/ids_mannheim/korap/authentication/APIAuthentication.java
index 9d66617..341c4d0 100644
--- a/full/src/main/java/de/ids_mannheim/korap/authentication/APIAuthentication.java
+++ b/full/src/main/java/de/ids_mannheim/korap/authentication/APIAuthentication.java
@@ -22,7 +22,6 @@
import de.ids_mannheim.korap.user.User;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.Element;
/**
* Authentication provider using JWT tokens
@@ -36,10 +35,6 @@
public static boolean DEBUG = false;
private JWTSigner signedToken;
- private Cache invalided =
- CacheManager.getInstance().getCache("id_tokens_inv");
- // private Cache id_tokens =
- // CacheManager.getInstance().getCache("id_tokens");
public APIAuthentication (FullConfiguration config) throws JOSEException {
this.signedToken = new JWTSigner(config.getSharedSecret(),
@@ -102,23 +97,6 @@
}
- // todo: cache and set expiration to token expiration. if token in
- // that cache, it is not to be used anymore!
- // @CacheEvict(value = "id_tokens", key = "#token")
- @Override
- public void removeUserSession (String token) throws KustvaktException {
- // invalidate token!
- invalided.put(new Element(token, null));
- }
-
-
- @Override
- public TokenContext refresh (TokenContext context)
- throws KustvaktException {
- return null;
- }
-
-
@Override
public TokenType getTokenType () {
return TokenType.API;
diff --git a/full/src/main/java/de/ids_mannheim/korap/authentication/AuthenticationIface.java b/full/src/main/java/de/ids_mannheim/korap/authentication/AuthenticationIface.java
index 47d0738..04f5a6a 100644
--- a/full/src/main/java/de/ids_mannheim/korap/authentication/AuthenticationIface.java
+++ b/full/src/main/java/de/ids_mannheim/korap/authentication/AuthenticationIface.java
@@ -16,10 +16,9 @@
throws KustvaktException;
- void removeUserSession (String token) throws KustvaktException;
-
-
- public TokenContext refresh (TokenContext context) throws KustvaktException;
+// void removeUserSession (String token) throws KustvaktException;
+//
+// public TokenContext refresh (TokenContext context) throws KustvaktException;
public TokenType getTokenType ();
diff --git a/full/src/main/java/de/ids_mannheim/korap/authentication/BasicAuthentication.java b/full/src/main/java/de/ids_mannheim/korap/authentication/BasicAuthentication.java
index f94ab3f..52f2885 100644
--- a/full/src/main/java/de/ids_mannheim/korap/authentication/BasicAuthentication.java
+++ b/full/src/main/java/de/ids_mannheim/korap/authentication/BasicAuthentication.java
@@ -92,20 +92,6 @@
return null;
}
-
- @Override
- public void removeUserSession (String token) throws KustvaktException {
- throw new KustvaktException(StatusCodes.NOT_SUPPORTED);
- }
-
-
- @Override
- public TokenContext refresh (TokenContext context)
- throws KustvaktException {
- return null;
- }
-
-
@Override
public TokenType getTokenType () {
return TokenType.BASIC;
diff --git a/full/src/main/java/de/ids_mannheim/korap/authentication/KustvaktAuthenticationManager.java b/full/src/main/java/de/ids_mannheim/korap/authentication/KustvaktAuthenticationManager.java
index 1a55905..a4179eb 100644
--- a/full/src/main/java/de/ids_mannheim/korap/authentication/KustvaktAuthenticationManager.java
+++ b/full/src/main/java/de/ids_mannheim/korap/authentication/KustvaktAuthenticationManager.java
@@ -153,7 +153,7 @@
}
try {
- provider.removeUserSession(context.getToken());
+// provider.removeUserSession(context.getToken());
User user = getUser(context.getUsername());
return provider.createTokenContext(user, context.params());
} catch (KustvaktException e) {
diff --git a/full/src/main/java/de/ids_mannheim/korap/authentication/OAuth2Authentication.java b/full/src/main/java/de/ids_mannheim/korap/authentication/OAuth2Authentication.java
index 14dbd42..80a3773 100644
--- a/full/src/main/java/de/ids_mannheim/korap/authentication/OAuth2Authentication.java
+++ b/full/src/main/java/de/ids_mannheim/korap/authentication/OAuth2Authentication.java
@@ -60,19 +60,6 @@
}
@Override
- public void removeUserSession (String token) throws KustvaktException {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public TokenContext refresh (TokenContext context)
- throws KustvaktException {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
public TokenType getTokenType () {
return TokenType.BEARER;
}
diff --git a/full/src/main/java/de/ids_mannheim/korap/authentication/SessionAuthentication.java b/full/src/main/java/de/ids_mannheim/korap/authentication/SessionAuthentication.java
index a5fab90..f4aa637 100644
--- a/full/src/main/java/de/ids_mannheim/korap/authentication/SessionAuthentication.java
+++ b/full/src/main/java/de/ids_mannheim/korap/authentication/SessionAuthentication.java
@@ -24,6 +24,7 @@
*
* @author hanl
*/
+@Deprecated
public class SessionAuthentication implements AuthenticationIface {
private static final Logger jlog = LogManager
@@ -86,17 +87,10 @@
}
- @Override
- public void removeUserSession (String token) {
- this.sessions.removeSession(token);
- }
-
-
- @Override
- public TokenContext refresh (TokenContext context) throws KustvaktException {
- throw new UnsupportedOperationException("method not supported");
- }
-
+// @Override
+// public void removeUserSession (String token) {
+// this.sessions.removeSession(token);
+// }
@Override
public TokenType getTokenType () {
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/FullConfiguration.java b/full/src/main/java/de/ids_mannheim/korap/config/FullConfiguration.java
index 175202a..a752399 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/FullConfiguration.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/FullConfiguration.java
@@ -31,9 +31,6 @@
import de.ids_mannheim.korap.interfaces.EncryptionIface;
import de.ids_mannheim.korap.oauth2.openid.OpenIdConfiguration;
import de.ids_mannheim.korap.utils.TimeUtils;
-import net.sf.ehcache.Cache;
-import net.sf.ehcache.CacheManager;
-import net.sf.ehcache.config.CacheConfiguration;
/**
* Configuration for Kustvakt full version including properties
@@ -125,12 +122,12 @@
setNamedVCPath(properties.getProperty("krill.namedVC", ""));
- Cache cache = CacheManager.newInstance().getCache("named_vc");
- CacheConfiguration config = cache.getCacheConfiguration();
- config.setMaxBytesLocalHeap(properties.getProperty("cache.max.bytes.local.heap", "256m"));
- config.setMaxBytesLocalDisk(properties.getProperty("cache.max.bytes.local.disk", "2G"));
- jlog.info("max local heap:"+config.getMaxBytesLocalHeapAsString());
- jlog.info("max local disk:"+config.getMaxBytesLocalDiskAsString());
+// Cache cache = CacheManager.newInstance().getCache("named_vc");
+// CacheConfiguration config = cache.getCacheConfiguration();
+// config.setMaxBytesLocalHeap(properties.getProperty("cache.max.bytes.local.heap", "256m"));
+// config.setMaxBytesLocalDisk(properties.getProperty("cache.max.bytes.local.disk", "2G"));
+// jlog.info("max local heap:"+config.getMaxBytesLocalHeapAsString());
+// jlog.info("max local disk:"+config.getMaxBytesLocalDiskAsString());
setMaxNumberOfUserQueries(Integer.parseInt(
properties.getProperty("max.user.persistent.queries", "20")));
diff --git a/full/src/main/resources/ehcache.xml b/full/src/main/resources/ehcache.xml
index 61b675f..12bd50b 100644
--- a/full/src/main/resources/ehcache.xml
+++ b/full/src/main/resources/ehcache.xml
@@ -5,36 +5,6 @@
<!--maxBytesLocalHeap="200M"-->
<diskStore path="./cache_store"/>
- <cache name='id_tokens'
- eternal='true'
- maxElementsOnDisk="10000000"
- memoryStoreEvictionPolicy="LRU"
- maxEntriesLocalHeap="50"
- overflowToDisk='true'/>
-
- <cache name='id_tokens_inv'
- eternal='true'
- maxElementsOnDisk="10000000"
- memoryStoreEvictionPolicy="LRU"
- maxEntriesLocalHeap="50"
- overflowToDisk='true'/>
-
- <cache name='auth_codes'
- timeToIdleSeconds="600"
- eternal='false'
- memoryStoreEvictionPolicy="LRU"
- maxEntriesLocalHeap="100"
- overflowToDisk='false'/>
-
- <cache name='resources'
- eternal='false'
- overflowToDisk='false'
- maxEntriesLocalHeap="60"
- timeToIdleSeconds="172800"
- diskSpoolBufferSizeMB="30"
- diskExpiryThreadIntervalSeconds="120"
- memoryStoreEvictionPolicy="LRU"
- />
<!-- EM -->
<cache name='authorization'
@@ -52,7 +22,7 @@
maxEntriesLocalHeap="500"
overflowToDisk='false'/>
- <cache name="named_vc"
+ <!-- <cache name="named_vc"
eternal="true"
memoryStoreEvictionPolicy="LRU"
maxBytesLocalHeap="256M"
@@ -60,5 +30,5 @@
diskExpiryThreadIntervalSeconds = "120" >
<persistence strategy="localTempSwap"/>
<sizeOfPolicy maxDepth="3000" maxDepthExceededBehavior="abort" />
- </cache>
+ </cache> -->
</ehcache>