-
Notifications
You must be signed in to change notification settings - Fork 827
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#187902333] Signed-off-by: Duane May <duane.may@broadcom.com> Signed-off-by: Peter Chen <peter-h.chen@broadcom.com>
- Loading branch information
1 parent
748f5f2
commit 6233e58
Showing
11 changed files
with
269 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...rg/cloudfoundry/identity/uaa/provider/saml/DefaultRelyingPartyRegistrationRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.cloudfoundry.identity.uaa.provider.saml; | ||
|
||
import org.cloudfoundry.identity.uaa.util.KeyWithCert; | ||
import org.cloudfoundry.identity.uaa.zone.IdentityZone; | ||
import org.cloudfoundry.identity.uaa.zone.ZoneAware; | ||
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration; | ||
import org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistrationRepository; | ||
|
||
/** | ||
* A {@link RelyingPartyRegistrationRepository} that always returns a default {@link RelyingPartyRegistrationRepository}. | ||
*/ | ||
public class DefaultRelyingPartyRegistrationRepository implements RelyingPartyRegistrationRepository, ZoneAware { | ||
public static final String CLASSPATH_DUMMY_SAML_IDP_METADATA_XML = "classpath:dummy-saml-idp-metadata.xml"; | ||
|
||
private final KeyWithCert keyWithCert; | ||
private final String samlEntityID; | ||
|
||
public DefaultRelyingPartyRegistrationRepository(String samlEntityID, | ||
KeyWithCert keyWithCert) { | ||
this.keyWithCert = keyWithCert; | ||
this.samlEntityID = samlEntityID; | ||
} | ||
|
||
/** | ||
* Returns the relying party registration identified by the provided | ||
* {@code registrationId}, or {@code null} if not found. | ||
* | ||
* @param registrationId the registration identifier | ||
* @return the {@link RelyingPartyRegistration} if found, otherwise {@code null} | ||
*/ | ||
@Override | ||
public RelyingPartyRegistration findByRegistrationId(String registrationId) { | ||
IdentityZone zone = retrieveZone(); | ||
|
||
String zonedSamlEntityID; | ||
if (!zone.isUaa() && zone.getConfig() != null && zone.getConfig().getSamlConfig() != null && zone.getConfig().getSamlConfig().getEntityID() != null) { | ||
zonedSamlEntityID = zone.getConfig().getSamlConfig().getEntityID(); | ||
} else { | ||
zonedSamlEntityID = this.samlEntityID; | ||
} | ||
|
||
return RelyingPartyRegistrationBuilder.buildRelyingPartyRegistration( | ||
zonedSamlEntityID, null, | ||
keyWithCert, CLASSPATH_DUMMY_SAML_IDP_METADATA_XML, registrationId, | ||
zonedSamlEntityID, zone.getConfig().getSamlConfig().isRequestSigned()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.