restructured middleware into hpcloud
This commit is contained in:
parent
3da964eeb9
commit
3f0cd69257
5
pom.xml
5
pom.xml
|
@ -120,11 +120,6 @@
|
|||
<artifactId>jsr305</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.hp.csbu.cc</groupId>
|
||||
<artifactId>CsMiddleware</artifactId>
|
||||
<version>3.34.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-recipes</artifactId>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
|
||||
import java.util.Map;
|
|
@ -1,9 +1,7 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
import org.apache.commons.pool.impl.GenericObjectPool;
|
||||
|
||||
//import com.hp.csbu.cc.security.cs.thrift.service.CsThriftService.Client;
|
||||
|
||||
/**
|
||||
* A factory for building {@link AuthClient}s.
|
||||
*
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
/**
|
||||
* An exception to indicate any connection issue.
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
public interface AuthConstants {
|
||||
/** 'Confirmed' or 'Invalid' */
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
/**
|
||||
* An exception to indicate any authentication error.
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletContext;
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
public class ExceptionHandlerUtil {
|
||||
|
|
@ -1,22 +1,25 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_DOMAIN_ID;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_DOMAIN_NAME;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_HP_IDM_ROLES;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_IDENTITY_STATUS;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_PROJECT_DOMAIN_ID;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_PROJECT_DOMAIN_NAME;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_PROJECT_ID;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_PROJECT_NAME;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_ROLES;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_SERVICE_CATALOG;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_TENANT_NAME;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_USER_DOMAIN_ID;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_USER_DOMAIN_NAME;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_USER_ID;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_TENANT_ID;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_USER_NAME;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.IdentityStatus;
|
||||
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_IDENTITY_STATUS;
|
||||
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_ROLES;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_TENANT_NAME;
|
||||
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_USER_ID;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_DOMAIN_ID;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_DOMAIN_NAME;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_PROJECT_ID;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_PROJECT_NAME;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_TENANT_ID;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_USER_NAME;
|
||||
import static com.hpcloud.middleware.AuthConstants.IdentityStatus;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_PROJECT_DOMAIN_ID;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_PROJECT_DOMAIN_NAME;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_USER_DOMAIN_ID;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_USER_DOMAIN_NAME;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_HP_IDM_ROLES;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_SERVICE_CATALOG;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Modifier;
|
|
@ -1,7 +1,7 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_SUBJECT_TOKEN;
|
||||
import static com.hp.csbu.cc.middleware.AuthConstants.TOKEN;
|
||||
import static com.hpcloud.middleware.AuthConstants.TOKEN;
|
||||
import static com.hpcloud.middleware.AuthConstants.AUTH_SUBJECT_TOKEN;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
import org.apache.commons.pool.impl.GenericObjectPool;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
public class SignatureBuilderException extends RuntimeException {
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.apache.http.client.ClientProtocolException;
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
import com.google.common.cache.*;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
|
@ -8,7 +8,8 @@ package com.hp.csbu.cc.middleware;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
public class TokenCache<K,V> {
|
||||
|
@ -25,10 +26,10 @@ public class TokenCache<K,V> {
|
|||
factory = appConfig.getFactory();
|
||||
|
||||
|
||||
cache = CacheBuilder.newBuilder().maximumSize(10000)
|
||||
cache = CacheBuilder.newBuilder().maximumSize(maxSize)
|
||||
.expireAfterWrite(timeToExpire, TimeUnit.SECONDS)
|
||||
.build(new CacheLoader<K, V>() {
|
||||
public V load(K key) throws TException,ClientProtocolException, UnavailableException {
|
||||
public V load(K key) throws TException,ClientProtocolException {
|
||||
|
||||
V value = null;
|
||||
AuthClient client = null;
|
||||
|
@ -45,14 +46,21 @@ public class TokenCache<K,V> {
|
|||
if(client!=null)
|
||||
factory.recycle(client);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public V getToken(K key) throws IOException {
|
||||
return cache.getUnchecked(key);
|
||||
public V getToken(K key) throws ClientProtocolException {
|
||||
V value = null;
|
||||
try {
|
||||
value = cache.get(key);
|
||||
throw new ClientProtocolException("Testing");
|
||||
|
||||
} catch (ExecutionException e) {
|
||||
logger.debug("had problem caching token");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public void put(K key, V value) {
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.apache.http.client.ClientProtocolException;
|
|
@ -1,4 +1,4 @@
|
|||
package com.hp.csbu.cc.middleware;
|
||||
package com.hpcloud.middleware;
|
||||
|
||||
/**
|
||||
* Created by johnderr on 6/25/14.
|
Loading…
Reference in New Issue