summaryrefslogtreecommitdiff
path: root/eaaf_modules
diff options
context:
space:
mode:
Diffstat (limited to 'eaaf_modules')
-rw-r--r--eaaf_modules/eaaf_module_pvp2_core/pom.xml40
-rw-r--r--eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/metadata/AbstractChainingMetadataProvider.java63
2 files changed, 64 insertions, 39 deletions
diff --git a/eaaf_modules/eaaf_module_pvp2_core/pom.xml b/eaaf_modules/eaaf_module_pvp2_core/pom.xml
index ef56624b..ca112162 100644
--- a/eaaf_modules/eaaf_module_pvp2_core/pom.xml
+++ b/eaaf_modules/eaaf_module_pvp2_core/pom.xml
@@ -76,7 +76,7 @@
<artifactId>mockwebserver</artifactId>
<scope>test</scope>
</dependency>
-
+
</dependencies>
<build>
@@ -92,33 +92,33 @@
<target>1.8</target>
</configuration>
<executions>
- <execution>
- <goals>
- <goal>compile</goal>
- <goal>testCompile</goal>
- </goals>
- </execution>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
</executions>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>3.1.0</version>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
- <!-- enable co-existence of testng and junit -->
+ <!-- enable co-existence of testng and junit -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
- <threadCount>1</threadCount>
+ <threadCount>1</threadCount>
</configuration>
<dependencies>
<dependency>
diff --git a/eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/metadata/AbstractChainingMetadataProvider.java b/eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/metadata/AbstractChainingMetadataProvider.java
index 80511f64..14a641e6 100644
--- a/eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/metadata/AbstractChainingMetadataProvider.java
+++ b/eaaf_modules/eaaf_module_pvp2_core/src/main/java/at/gv/egiz/eaaf/modules/pvp2/impl/metadata/AbstractChainingMetadataProvider.java
@@ -21,6 +21,7 @@ package at.gv.egiz.eaaf.modules.pvp2.impl.metadata;
import java.io.IOException;
import java.security.cert.CertificateException;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -72,7 +73,7 @@ public abstract class AbstractChainingMetadataProvider implements IGarbageCollec
*
*/
public AbstractChainingMetadataProvider() {
- internalResolvers = Collections.synchronizedList(Collections.emptyList());
+ internalResolvers = Collections.synchronizedList(new ArrayList<>());
}
@@ -110,17 +111,10 @@ public abstract class AbstractChainingMetadataProvider implements IGarbageCollec
@Override
public synchronized boolean refreshMetadataProvider(final String entityId) {
try {
- // check if metadata provider is already loaded
- try {
- if (resolveEntityDescripor(entityId) != null) {
- return true;
-
- }
-
- } catch (final ResolverException e) {
- log.debug("Metadata for EntityId: {} is not valid. Starting refresh ... ", entityId);
-
- }
+ //if (resolveEntityDescriporForRefesh(entityId)) {
+ // return true;
+ //
+ //}
// reload metadata provider
final String metadataUrl = getMetadataUrl(entityId);
@@ -131,25 +125,33 @@ public abstract class AbstractChainingMetadataProvider implements IGarbageCollec
// check if MetadataProvider is actually loaded
final MetadataResolver loadedResover = actuallyLoadedResolver.get(metadataUrl);
if (loadedResover instanceof RefreshableMetadataResolver) {
- ((RefreshableMetadataResolver) loadedResover).refresh();
- log.info("SAML2 metadata for service provider: " + entityId + " is refreshed.");
- return true;
+ try {
+ ((RefreshableMetadataResolver) loadedResover).refresh();
+ log.info("SAML2 metadata for service provider: {} is refreshed.", entityId);
+ return true;
+
+ } catch (final ResolverException e) {
+ log.info("Can not refresh SAML2 metadata for entityId: {}. Reason: {}", entityId, e.getMessage());
+ destroyMetadataResolver(loadedResover);
+ internalResolvers.remove(loadedResover);
+
+ }
} else {
// load new Metadata Provider
internalResolvers.add(createNewMetadataProvider(metadataUrl));
- log.info("SAML2 metadata for service provider: " + entityId + " is added.");
+ log.info("SAML2 metadata for service provider: {} is added.", entityId);
return true;
}
} else {
log.debug(
- "Can not refresh SAML2 metadata: NO SAML2 metadata URL for SP with Id: " + entityId);
+ "Can not refresh SAML2 metadata: NO SAML2 metadata URL for SP with Id: {}", entityId);
}
- } catch (final IOException | ResolverException | EaafConfigurationException | CertificateException e) {
+ } catch (final IOException | EaafConfigurationException | CertificateException e) {
log.warn("Refresh SAML2 metadata for service provider: " + entityId + " FAILED.", e);
}
@@ -158,6 +160,7 @@ public abstract class AbstractChainingMetadataProvider implements IGarbageCollec
}
+
@Override
public final MetadataFilter getMetadataFilter() {
log.warn("{} does NOT support {}", AbstractChainingMetadataProvider.class.getName(),
@@ -467,10 +470,32 @@ public abstract class AbstractChainingMetadataProvider implements IGarbageCollec
private EntityDescriptor resolveEntityDescripor(String entityId) throws ResolverException {
final CriteriaSet criteria = new CriteriaSet();
criteria.add(new EntityIdCriterion(entityId));
- return resolveSingle(criteria);
+ return internalResolveSingle(criteria);
}
+// private boolean resolveEntityDescriporForRefesh(String entityId) {
+// final CriteriaSet criteria = new CriteriaSet();
+// criteria.add(new EntityIdCriterion(entityId));
+// for (final MetadataResolver resolver : internalResolvers) {
+// try {
+// if (resolver instanceof RefreshableMetadataResolver
+// && resolver.resolveSingle(criteria) != null) {
+//
+// ((RefreshableMetadataResolver)resolver).refresh();
+// return true;
+//
+// }
+//
+// } catch (final ResolverException e) {
+// continue;
+//
+// }
+// }
+//
+// return false;
+// }
+
private void destroyMetadataResolver(MetadataResolver resolver) {
if (resolver instanceof AbstractMetadataResolver) {
final AbstractMetadataResolver httpprovider = (AbstractMetadataResolver) resolver;