ZoneAwareIdpMetadataGenerator extends IdpMetadataGenerator { @Override public String getEntityId() { String entityId = super.getEntityId(); if(StringUtils.hasText(IdentityZoneHolder.get().getConfig().getSamlConfig().getEntityID())) { return IdentityZoneHolder.get().getConfig().getSamlConfig().getEntityID(); } else if (UaaUrlUtils.isUrl(entityId)) { return UaaUrlUtils.addSubdomainToUrl(entityId, IdentityZoneHolder.get().getSubdomain()); } else { return UaaUrlUtils.getSubdomain(IdentityZoneHolder.get().getSubdomain()) + entityId; } }  @Override boolean isAssertionsSigned(); @Override int getAssertionTimeToLiveSeconds(); @Override IdpExtendedMetadata generateExtendedMetadata(); @Override String getEntityId(); @Override String getEntityBaseURL(); @Override boolean isWantAuthnRequestSigned(); @Override EntityDescriptor generateMetadata();  }
@Test void entityIDHonored() { IdentityZoneHolder.set(notUaaZone); assertEquals(notUaaZoneId + "." + IdentityZoneHolder.getUaaZone().getConfig().getSamlConfig().getEntityID(), zoneAwareIdpMetadataGenerator.getEntityId()); notUaaZoneConfiguration.getSamlConfig().setEntityID("randomID"); assertEquals("randomID", zoneAwareIdpMetadataGenerator.getEntityId()); }