Skip to content

Commit

Permalink
Implementation Commit: Replace Caching Zone Aware Idp Metadata manage…
Browse files Browse the repository at this point in the history
…r with a non caching one

Signed-off-by: Henry <henry.zhao1@ge.com>
  • Loading branch information
RoopGuron authored and 6palace committed Mar 30, 2017
1 parent 1c7cc58 commit 742a174
Show file tree
Hide file tree
Showing 12 changed files with 477 additions and 915 deletions.
Expand Up @@ -112,7 +112,7 @@ public ResponseEntity<IdentityProvider> createIdentityProvider(@RequestBody Iden
SamlIdentityProviderDefinition definition = ObjectUtils.castInstance(body.getConfig(), SamlIdentityProviderDefinition.class);
definition.setZoneId(zoneId);
definition.setIdpEntityAlias(body.getOriginKey());
samlConfigurator.addSamlIdentityProviderDefinition(definition);
samlConfigurator.validateSamlIdentityProviderDefinition(definition);
body.setConfig(definition);
}
try {
Expand Down Expand Up @@ -161,7 +161,7 @@ public ResponseEntity<IdentityProvider> updateIdentityProvider(@PathVariable Str
SamlIdentityProviderDefinition definition = ObjectUtils.castInstance(body.getConfig(), SamlIdentityProviderDefinition.class);
definition.setZoneId(zoneId);
definition.setIdpEntityAlias(body.getOriginKey());
samlConfigurator.addSamlIdentityProviderDefinition(definition);
samlConfigurator.validateSamlIdentityProviderDefinition(definition);
body.setConfig(definition);
}
IdentityProvider updatedIdp = identityProviderProvisioning.update(body);
Expand Down
Expand Up @@ -62,7 +62,7 @@ public ResponseEntity<SamlServiceProvider> createServiceProvider(@RequestBody Sa
String zoneId = IdentityZoneHolder.get().getId();
body.setIdentityZoneId(zoneId);

samlConfigurator.addSamlServiceProvider(body);
samlConfigurator.validateSamlServiceProvider(body);

SamlServiceProvider createdSp = serviceProviderProvisioning.create(body);
return new ResponseEntity<>(createdSp, HttpStatus.CREATED);
Expand All @@ -80,7 +80,7 @@ public ResponseEntity<SamlServiceProvider> updateServiceProvider(@PathVariable S
}
body.setEntityId(existing.getEntityId());

samlConfigurator.addSamlServiceProvider(body);
samlConfigurator.validateSamlServiceProvider(body);

SamlServiceProvider updatedSp = serviceProviderProvisioning.update(body);
return new ResponseEntity<>(updatedSp, OK);
Expand Down
Expand Up @@ -105,10 +105,9 @@ public List<SamlIdentityProviderDefinition> getIdentityProviderDefinitions(List<
/**
* adds or replaces a SAML identity proviider
* @param providerDefinition - the provider to be added
* @return an array consisting of {provider-added, provider-deleted} where provider-deleted may be null
* @throws MetadataProviderException if the system fails to fetch meta data for this provider
*/
public synchronized ExtendedMetadataDelegate[] addSamlIdentityProviderDefinition(SamlIdentityProviderDefinition providerDefinition) throws MetadataProviderException {
public synchronized void validateSamlIdentityProviderDefinition(SamlIdentityProviderDefinition providerDefinition) throws MetadataProviderException {
ExtendedMetadataDelegate added, deleted=null;
if (providerDefinition==null) {
throw new NullPointerException();
Expand Down Expand Up @@ -140,8 +139,6 @@ public synchronized ExtendedMetadataDelegate[] addSamlIdentityProviderDefinition
if (entityIDexists) {
throw new MetadataProviderException("Duplicate entity ID:"+entityIDToBeAdded);
}

return new ExtendedMetadataDelegate[] {added, deleted};
}

public synchronized ExtendedMetadataDelegate removeIdentityProviderDefinition(SamlIdentityProviderDefinition providerDefinition) {
Expand Down

0 comments on commit 742a174

Please sign in to comment.